class Host <ActiveRecord::Base
has_many :events
end
class Event < ActiveRecord::Base
belongs_to :host
end
ruby_sapporo = Host.find(:first)
ruby_sapporo.events.each do ¦event¦
puts event.name
end
class CreateUsers <ActiveRecord::Migration
def self.up
create_table "users" do ¦t¦
t.column :login, :string
t.column :email, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
def self.down
drop_table "users"
end
end
ActionController::Routing::Routes.draw do ¦map¦
#You can have the root of your site routed by hooking up
# '' -- just remember to delete public/index.html.
map.connect '', :controller => "event", :action => "list"
# Allow downloading Web Service WSDL as a file
# with an extension instead of a file named 'wsdl'
map.connect ':controller/service.wsdl', :action => 'wsdl'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id.:format'
map.connect ':controller/:action/:id'
end
class CreateUsers <ActiveRecord::Migration
def self.up
create_table( "users" ) { ¦t¦
t.column( :login, :string )
t.column( :email, :string )
t.column( :created_at, :datetime )
t.column( :updated_at, :datetime )
}
end
...
end
71.
class CreateUsers <ActiveRecord::Migration
def self.up
create_table "users" do ¦t¦
t.column :login, :string
t.column :email, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
...
end
class CreateUsers <ActiveRecord::Migration
def self.up
create_table "users" do ¦t¦
t.column :login, :string
t.column :email, :string
t.column :created_at, :datetime
t.column :updated_at, :datetime
end
end
...
end
describe Array, "whenempty" do
before do
@empty_array = []
end
it "should be empty" do
@empty_array.should be_empty
end
it "should size 0" do
@empty_array.size.should == 0
end
after do
@empty_array = nil
end
end