53. 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
62. 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
92. describe Array, "when empty" 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