code stringlengths 1 1.73M | language stringclasses 1
value |
|---|---|
class Event < ActiveRecord::Base
belongs_to :person
POST=1
COMMENT=2
end
| Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: posts
#
# id :integer(11) not null, primary key
# blog_id :integer(11)
# topic_id :integer(11)
# person_id :integer(11)
# title :string(255)
... | Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: communications
#
# id :integer(11) not null, primary key
# subject :string(255)
# content :text
# parent_id :string(255)
# sender_id :integer(11)
# recipien... | Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: posts
#
# id :integer(11) not null, primary key
# blog_id :integer(11)
# topic_id :integer(11)
# person_id :integer(11)
# title :string(255)
... | Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: forums
#
# id :integer(11) not null, primary key
# name :string(255)
# description :text
# topics_count :integer(11) default(0), not null
# created_at :datetime
# updated_at :datetime
#
cl... | Ruby |
class AllPerson < Person
is_indexed :fields => [ 'name', 'description' ]
end | Ruby |
class PersonMailer < ActionMailer::Base
extend PreferencesHelper
def domain
@domain ||= PersonMailer.global_prefs.domain
end
def server
@server_name ||= PersonMailer.global_prefs.server_name
end
def password_reminder(person)
from "Password reminder <password-reminder@#{domain}>"... | Ruby |
class Tag < ActiveRecord::Base
end
| Ruby |
class Categoryt < ActiveRecord::Base
end
| Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: activities
#
# id :integer(11) not null, primary key
# public :boolean(1)
# item_id :integer(11)
# person_id :integer(11)
# item_type :string(255)
# created_at :datetime
# updated_at :datetime
#... | Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: comments
#
# id :integer(11) not null, primary key
# commenter_id :integer(11)
# commentable_id :integer(11)
# commentable_type :string(255) default(""), not null
# body :text
# created_at ... | Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: connections
#
# id :integer(11) not null, primary key
# person_id :integer(11)
# contact_id :integer(11)
# status :integer(11)
# accepted_at :datetime
# created_at :datetime
# updated_at :datetime ... | Ruby |
class Conversation < ActiveRecord::Base
has_many :messages, :order => :created_at
end
| Ruby |
class Category < ActiveRecord::Base
end
| Ruby |
class Friend < ActiveRecord::Base
belongs_to :person
belongs_to :follower, :class_name => "Person", :foreign_key => "friend_id"
end
| Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: feeds
#
# id :integer(11) not null, primary key
# person_id :integer(11)
# activity_id :integer(11)
#
class Feed < ActiveRecord::Base
belongs_to :activity
belongs_to :person
end
| Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: communications
#
# id :integer(11) not null, primary key
# subject :string(255)
# content :text
# parent_id :string(255)
# sender_id :integer(11)
# recipien... | Ruby |
class Article < ActiveRecord::Base
belongs_to :person
belongs_to :category
belongs_to :categoryt
belongs_to :tag
has_many :article_comments, :order => 'created_at desc'
has_one :most_recent_comment, :class_name => 'ArticleComment', :order => 'created_at desc'
def before_create
# self.category_id = 3
# se... | Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: blogs
#
# id :integer(11) not null, primary key
# person_id :integer(11)
# created_at :datetime
# updated_at :datetime
#
class Blog < ActiveRecord::Base
belongs_to :person
has_many :posts, :order => "created_at DESC"... | Ruby |
class ArticleComment < ActiveRecord::Base
belongs_to :commenter, :class_name => "Person",
:foreign_key => "person_id"
belongs_to :article, :counter_cache => true
end
| Ruby |
# == Schema Information
# Schema version: 26
#
# Table name: topics
#
# id :integer(11) not null, primary key
# forum_id :integer(11)
# person_id :integer(11)
# name :string(255)
# forum_posts_count :integer(11) default(0), not null
# created_at ... | Ruby |
class MessagesController < ApplicationController
before_filter :login_required, :setup
before_filter :authenticate_person, :only => [:show]
before_filter :handle_cancel, :only => [:create]
before_filter :validate_reply, :only => [:create]
# GET /messages
def index
@messages = current_person.received_m... | Ruby |
# NOTE: We use "posts" for both forum topic posts and blog posts,
# There is some trickery to handle the two in a unified manner.
class PostsController < ApplicationController
include ApplicationHelper
before_filter :login_required
before_filter :get_instance_vars
before_filter :authorize_new, :only => [:cre... | Ruby |
class ConnectionsController < ApplicationController
before_filter :login_required, :setup
before_filter :authorize_view, :only => :index
before_filter :authorize_person, :only => [:edit, :update, :destroy]
before_filter :redirect_for_inactive, :only => [:edit, :update]
# Show all the contacts for a pers... | Ruby |
class CategoriesController < ApplicationController
# GET /categories
# GET /categories.xml
def index
@categories = Category.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @categories }
end
end
# GET /categories/1
# GET /categories/1.xml
... | Ruby |
class Admin::PreferencesController < ApplicationController
before_filter :login_required, :admin_required
before_filter :setup
def index
render :action => "show"
end
def show
respond_to do |format|
format.html
end
end
def edit
end
def update
respond_to do |format|
... | Ruby |
class Admin::ForumsController < ApplicationController
before_filter :login_required, :admin_required, :setup
before_filter :protect_last_forum, :only => :destroy
def index
@forums = Forum.find(:all)
respond_to do |format|
format.html
end
end
def show
@forum = Forum.find(params[:id]... | Ruby |
class Admin::PeopleController < ApplicationController
before_filter :login_required, :admin_required
def index
@people = Person.paginate(:all, :page => params[:page], :order => :name)
end
def update
@person = Person.find(params[:id])
if current_person?(@person)
flash[:error] = "Action faile... | Ruby |
class ArticlesController < ApplicationController
before_filter :auth_login,:except => [:show]
def new
not_show_toolbar
@images=(params[:imgs].nil?)? []:params[:imgs].split("==");
@article = Article.new
@article.body = params[:body]||""
@article.person_id= current_person.id
@article.category_id ... | Ruby |
class PasswordRemindersController < ApplicationController
before_filter :check_can_send_email
def new
end
def create
person = Person.find_by_email(params[:person][:email])
respond_to do |format|
format.html do
if person.nil?
flash.now[:error] = "Invalid email address"
... | Ruby |
class HomeController < ApplicationController
skip_before_filter :require_activation
def tooltips
not_show_toolbar
end
def index
@body = "home"
@topics = Topic.find_recent
@members = Person.find_recent
if logged_in?
@feed = current_person.feed
@some_contacts = current_person.som... | Ruby |
class ArticleCommentsController < ApplicationController
# GET /article_comments
# GET /article_comments.xml
def index
@article_comments = ArticleComment.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @article_comments }
end
end
def add
... | Ruby |
class TopicsController < ApplicationController
before_filter :login_required
before_filter :admin_required, :only => [:edit, :update, :destroy]
before_filter :setup
def index
redirect_to forum_url(params[:forum_id])
end
def show
@topic = Topic.find(params[:id])
@posts = @topic.posts
end... | Ruby |
class PhotosController < ApplicationController
before_filter :login_required
before_filter :correct_user_required, :only => [ :edit, :update, :destroy ]
def index
@photos = current_person.photos
respond_to do |format|
format.html
end
end
def new
@photo = Photo.new
respond_to... | Ruby |
# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
include AuthenticatedSystem
include SharedHelper
include ... | Ruby |
class ActivitiesController < ApplicationController
before_filter :not_implemented, :except => [:destroy]
before_filter :authorize_user, :only => :destroy
# GET /activities
# GET /activities.xml
def index
@activities = Activity.find(:all)
respond_to do |format|
format.html # index.html.erb
... | Ruby |
class SearchesController < ApplicationController
include ApplicationHelper
before_filter :login_required
def index
redirect_to(home_url) and return if params[:q].nil?
query = params[:q].strip
model = strip_admin(params[:model])
page = params[:page] || 1
unless %(Person Message Fo... | Ruby |
class TagsController < ApplicationController
# GET /tags
# GET /tags.xml
def index
@tags = Tag.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @tags }
end
end
# GET /tags/1
# GET /tags/1.xml
def show
@tag = Tag.find(params[:id])
... | Ruby |
class FriendsController < ApplicationController
# GET /friends
# GET /friends.xml
def index
@friends = Friend.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @friends }
end
end
# GET /friends/1
# GET /friends/1.xml
def show
@friend ... | Ruby |
class BlogsController < ApplicationController
before_filter :login_required
def new
@images=(params[:imgs].nil?)? []:params[:imgs].split("==");
@article = Article.new
@article.body = params[:body]||""
@article.person_id= current_person.id
end
def show
@article = Article.find(params[:id])
respo... | Ruby |
class CategorytsController < ApplicationController
# GET /categoryts
# GET /categoryts.xml
def index
@categoryts = Categoryt.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @categoryts }
end
end
# GET /categoryts/1
# GET /categoryts/1.xml... | Ruby |
class BackendController < ApplicationController
wsdl_service_name 'Backend'
web_service_api ArticleApi
web_service_scaffold :invoke
def upd_cat1(name,newname)
@categn = Category.find_by_name(name)
if @categn
@categn.name = newname
@categn.save
end
return true
end
def del_cat1(n... | Ruby |
class ForumsController < ApplicationController
before_filter :login_required, :setup
def index
@forums = Forum.find(:all)
if @forums.length == 1
redirect_to forum_url(@forums.first) and return
end
respond_to do |format|
format.html
end
end
def show
@forum = Forum.find(p... | Ruby |
class PeopleController < ApplicationController
skip_before_filter :require_activation, :only => :verify_email
skip_before_filter :admin_warning, :only => [ :show, :update ]
before_filter :login_required, :only => [ :show, :edit, :update ]
before_filter :correct_user_required, :only => [ :edit, :update ]
be... | Ruby |
# This controller handles the login/logout function of the site.
class SessionsController < ApplicationController
skip_before_filter :require_activation, :only => [:new, :destroy]
def new
@body = "login single-col"
end
def rlogin
person = Person.authenticate(params[:email], params[:password])
unles... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format
# (all these examples are active by default):
# Inflector.inflections do |inflect|
# inflect.plural /^(ox)$/i, '\1en'
# inflect.singular /^(ox)en/i, '\1'
# inflect.irregular 'person', 'people'
# i... | Ruby |
# This overrides the :per_page attribute for will_paginate.
# The default for will_paginate is 30, which seems a little high.
class ActiveRecord::Base
def self.per_page
10
end
end | Ruby |
# Column sizes
FULL = 20
LEFT = LARGER_COLUMN = 14
RIGHT = SMALLER_COLUMN = 6
# Database strings typically can't be longer than 255.
MAX_STRING_LENGTH = 255
MEDIUM_STRING_LENGTH = 100
SMALL_STRING_LENGTH = 40
MAX_TEXT_LENGTH = 5000
MEDIUM_TEXT_LENGTH = 500
SMALL_TEXT_LENGTH = 300
# The number of raster colums.
N_COL... | Ruby |
require 'digest/sha1'
require 'rand'
require 'will_paginate'
require 'string'
require 'rdiscount'
# In some cases autotest interprets the initialization of the UUID generator
# as something new, and so just keeps running the tests.
# This stub here fixes the problem.
unless test?
require 'uuid'
else
class UUID
... | Ruby |
require 'openssl'
module Crypto
def self.create_keys(priv = "rsa_key", pub = "#{priv}.pub", bits = 1024)
private_key = OpenSSL::PKey::RSA.new(bits)
File.open(priv, "w+") { |fp| fp << private_key.to_s }
File.open(pub, "w+") { |fp| fp << private_key.public_key.to_s }
private_key
end
cla... | Ruby |
# These settings change the behavior of Rails 2 apps and will be defaults
# for Rails 3. You can remove this initializer when Rails 3 is released.
# Only save the attributes that have changed since the record was loaded.
ActiveRecord::Base.partial_updates = true
# Include ActiveRecord class name as root for JSON seri... | Ruby |
# Methods in this file need to be loaded first.
# This is because other initializers may depend on them.
# The funky filename? Rails loads the initializers in alphabetical order.
def development?
env_is('development')
end
def production?
env_is('production')
end
def test?
env_is('test')
end
def env_is(env)
... | Ruby |
# Be sure to restart your server when you modify this file.
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
| Ruby |
# Provide a maximally flexible Markaby builder.
# For Markaby, see http://redhanded.hobix.com/inspect/markabyForRails.html
# The plugin is broken in Rails 2.0.2. Get a working plugin as follows:
# $ cd vendor/plugins
# $ git clone http://github.com/giraffesoft/markaby/tree/master
# TODO: figure out how to make this n... | Ruby |
# ---------------------------------------------------------------------------
# collect_every(n [,fill=false[,offset=0]]) => an array
# collect_every(n [,fill=false[,offset=0]]) {|item| block} => an_array
# ---------------------------------------------------------------------------
# If a block is gi... | Ruby |
begin
unless test?
global_prefs = Preference.find(:first)
if global_prefs.email_notifications?
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => global_prefs.smtp_server,
:port => 25,
:domain => global_prefs.domain
... | Ruby |
ActionController::Routing::Routes.draw do |map|
map.resources :friends, :collection => { :change => :get }
map.resources :article_comments, :collection => { :add => :get }
map.resources :tags, :collection => { :add => :get }
map.resources :tags, :member => { :articles => :get,:add => :get, :blogs => :get ... | Ruby |
# Don't change this file!
# Configure your app in config/environment.rb and config/environments/*.rb
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
module Rails
class << self
def boot!
unless booted?
preinitialize
pick_boot.run
end
end
def booted?
... | Ruby |
# Be sure to restart your server when you modify this file
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.1... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Full error repor... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.ca... | Ruby |
# Settings specified here will take precedence over those in config/environment.rb
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between... | Ruby |
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
| Ruby |
module AuthenticatedSystem
protected
# Returns true or false if the person is logged in.
# Preloads @current_person with the person model if they're logged in.
def logged_in?
current_person != :false
end
# Accesses the current person from the session. Set it to :false if login fails
# ... | Ruby |
class EventManager
def initialize(id)
@id=id.to_s
end
def events_of_friends
Event.find(:all,:conditions=>["person_id in (select friend_id from friends where person_id=>:person_id)",{:person_id=>@id}],:order=>'created_at desc')
end
def my_events
his_events(@id)
end
def his_events(person_id)
Eve... | Ruby |
module ActivityLogger
# Add an activity to the feeds of a person's contacts.
# Usually, we only add to the feeds of the contacts, not the person himself.
# For example, if a person makes a forum post, the activity shows up in
# his contacts' feeds but not his.
# The :include_person option is to handle the ca... | Ruby |
module AuthenticatedTestHelper
# Sets the current person in the session from the person fixtures.
# Returns the person to allow @person = login_as(:quentin) construction.
def login_as(person)
if person.is_a?(Person)
id = person.id
elsif person.is_a?(Symbol)
person = people(person)
id = p... | Ruby |
class String
def to_safe_uri
self.strip.downcase.gsub('&', 'and').gsub(' ', '-').gsub(/[^\w-]/,'')
end
end | Ruby |
class FriendManager
def initialize(id)
@id=id.to_s
end
def one_of_friends?(friend_id)
if @friends_ids.nil?
require 'set'
friends=Friend.find(:all,:conditions=>["person_id=:person_id",{:person_id=>@id}])
friends=[] if friends.nil?
@friends_ids=Set.new
friends.each{|n| @friends_ids<<... | Ruby |
require 'active_record'
require 'active_record/fixtures'
desc "Install Insoshi"
task :install => :environment do |t|
Rake::Task["db:migrate"].invoke
Preference.create!
end
| Ruby |
namespace :db do
namespace :migrate do
desc "Migrate and prepare test database"
task :both do
Rake::Task["db:migrate"].invoke
Rake::Task["db:test:prepare"].invoke
end
end
end | Ruby |
namespace :db do
desc "Recycle the database by dropping, recreating, and migrating"
task :recycle => :environment do
filename = File.join(RAILS_ROOT, 'config', 'database.yml')
config = YAML::load(File.open(filename))
env = ENV['RAILS_ENV'] || 'development'
database = config[env]['database']
... | Ruby |
# Provide tasks to load and delete sample user data.
require 'active_record'
require 'active_record/fixtures'
#DATA_DIRECTORY = File.join(RAILS_ROOT, "lib", "tasks", "sample_data")
namespace :db do
namespace :demo_data do
desc "Load demo data"
task :load => :environment do |t|
create_demo_people
... | Ruby |
# Provide tasks to load and delete sample user data.
require 'active_record'
require 'active_record/fixtures'
DATA_DIRECTORY = File.join(RAILS_ROOT, "lib", "tasks", "sample_data")
namespace :db do
namespace :sample_data do
desc "Load sample data"
task :load => :environment do |t|
Rake::Task["insta... | Ruby |
require 'active_record'
require 'active_record/fixtures'
namespace :feed do
desc "Remove duplicate feed items"
task :undup => :environment do |t|
feed = Feed.find(:all, :order => 'person_id, activity_id')
dups = []
feed.each_with_index do |item, i|
dups.push(item) if i > 0 and same?(item, feed[i-... | Ruby |
# = Spec, with Ultrasphinx
# Based on test_with_ultrasphinx from
# http://stephencelis.com/archive/2008/4/testing-with-ultrasphinx
#
# See [Ultrasphinx](http://blog.evanweaver.com/files/doc/fauna/ultrasphinx).
#
# This Rake task automates Ultrasphinx in a testing environment. It will start
# or set up Sphinx on your te... | Ruby |
namespace :db do
desc "Recycle the database by dropping, recreating, and migrating"
task :conversation_bootstrap => :environment do
messages = Message.find(:all, :order => :created_at)
unless messages.empty?
puts "Bootstrapping existing messages by adding conversation ids."
messages.each do |me... | Ruby |
#
# = rand.rb -- library for picking random elements and shuffling
#
# Copyright (C) 2004 Ilmari Heikkinen
#
# Documentation:: Christian Neukirchen <mailto:chneukirchen@gmail.com>
#
module Enumerable
# Choose and return a random element of the Enumerable.
# [1, 2, 3, 4].pick #=> 2 (or 1, 3, 4)
def pick
... | Ruby |
class CreateArticlesWebsitesinfsJoin < ActiveRecord::Migration
def self.up
create_table :articles_websitesinfs, :id => false do |t|
t.column :websitesinf_id, :integer, :null => false
t.column :article_id, :integer, :null => false
end
execute "alter table articles_websitesinfs add pri... | Ruby |
class CreateTasksdescs < ActiveRecord::Migration
def self.up
create_table :tasksdescs do |t|
t.column :websitesinf_id, :integer, :default => 0, :null => false
t.column :taskdes1, :string, :limit => 100, :default => "", :null => false
t.column :ecomments1, :text, :limit =... | Ruby |
class CreateUalias < ActiveRecord::Migration
def self.up
create_table :ualias do |t|
t.column :user_id, :integer
t.column :ualiasn, :string
t.column :iscurrent, :boolean, :default => false
end
end
def self.down
drop_table :ualias
end
end
| Ruby |
class CreateSubtasksdescs < ActiveRecord::Migration
def self.up
create_table :subtasksdescs do |t|
t.column :tasksdesc_id, :integer, :default => 0, :null => false
t.column :conturl1, :string, :limit => 100, :default => "", :null => false
t.column :uname1, ... | Ruby |
class CreatePages < ActiveRecord::Migration
def self.up
create_table :pages do |t|
t.column :title, :string
t.column :permalink, :string
t.column :body, :text
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
drop_table :pages
en... | Ruby |
class CreateArticles < ActiveRecord::Migration
def self.up
create_table :articles do |t|
t.column :user_id, :integer
t.column :title, :string
t.column :synopsis, :text, :limit => 1000
t.column :body, :text, :limit => 20000
t.column :published, :boolean, :default => false
t... | Ruby |
class CreateComments < ActiveRecord::Migration
def self.up
create_table :comments do |t|
t.column :article_id, :integer
t.column :user_id, :integer
t.column :body, :text
t.column :created_at, :datetime
end
add_index :comments, :article_id
add_column :articles, :comments_co... | Ruby |
class CreateWebsitesinfs < ActiveRecord::Migration
def self.up
create_table :websitesinfs do |t|
t.column :name1, :string, :limit => 100, :default => "", :null => false
t.column :description1, :text, :limit => 255, :null => false
t.column :url1, :string, :limit... | Ruby |
class CreateCategories2 < ActiveRecord::Migration
def self.up
create_table :categories2 do |t|
t.column :name, :string
t.column :websitesinf_id, :integer
end
end
def self.down
drop_table :categories2
end
end
| Ruby |
class CreatePhotos < ActiveRecord::Migration
def self.up
create_table :photos do |t|
t.column :article_id, :integer
t.column :title, :string
t.column :body, :text
t.column :created_at, :datetime
# the following columns are required for attachment_fu
t.column :content_type, :str... | Ruby |
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.column :name, :string
t.column :hashed_password, :string
t.column :salt, :string
t.column :question, :string, :limit => 255, :default => "", :null => false
t.column :q... | Ruby |
class CreateImageurls < ActiveRecord::Migration
def self.up
create_table :imageurls do |t|
t.column :article_id, :integer
t.column :simgurl, :string
end
end
def self.down
drop_table :imageurls
end
end
| Ruby |
class CreateRolesUsersJoin < ActiveRecord::Migration
def self.up
create_table :roles_users, :id => false do |t|
t.column :role_id, :integer, :null => false
t.column :user_id, :integer, :null => false
end
admin_user = User.create(:name => 'Admin',
:email_addr ... | Ruby |
class CreateRoles < ActiveRecord::Migration
def self.up
create_table :roles do |t|
t.column :name, :string
end
Role.create(:name => 'Administrator')
end
def self.down
drop_table :roles
end
end
| Ruby |
class CreateCategories < ActiveRecord::Migration
def self.up
create_table :categories do |t|
t.column :name, :string
end
end
def self.down
drop_table :categories
end
end
| Ruby |
class AddOpenId < ActiveRecord::Migration
def self.up
add_column :users, :identity_url, :string
end
def self.down
remove_column :users, :identity_url
end
end | Ruby |
class AddTaggingSupport < ActiveRecord::Migration
def self.up
create_table :tags, :force => true do |t|
t.column :name, :string
end
create_table :taggings, :force => true do |t|
t.column :tag_id, :integer
t.column :taggable_id, :integer
t.column :taggable_type, :string
t... | Ruby |
class AddOpenIdAuthenticationTables < ActiveRecord::Migration
def self.up
create_table :open_id_authentication_associations, :force => true do |t|
t.column :lifetime, :integer
t.column :assoc_type, :string
t.column :handle, :string
t.column :issued, :integer
t.column :ser... | Ruby |
ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'test_help'
class Test::Unit::TestCase
# Transactional fixtures accelerate your tests by wrapping each test method
# in a transaction that's rolled back on completion. This ensures that the
# test datab... | Ruby |
#!E:/InstantRails/ruby/bin/ruby
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
# If you're using RubyGems and mod_ruby, this require should be changed to an absolute path one, like:
# "/usr/local/lib/ruby/gems/1.8/gems/rails-0.8.0/lib/dispatcher" -- otherwise performance is seve... | Ruby |
#!E:/InstantRails/ruby/bin/ruby
#
# You may specify the path to the FastCGI crash log (a log of unhandled
# exceptions which forced the FastCGI instance to exit, great for debugging)
# and the number of requests to process before running garbage collection.
#
# By default, the FastCGI crash log is RAILS_ROOT/log/fastcg... | Ruby |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.