This is likely another newbie missing the forest for the trees types of questions, but I can''t seem to find my way out. Any help is greatly appreciated. I''m getting a "NoMethodError in Reservations#create" error (full error below) when trying to add a collection_select field to the new.html.erb created by the scaffold generator. My app is, at present, a trivial room reservation maker. It has rooms, people and reservations. Rooms and People stand alone, Reservations references both Rooms and People. def self.up create_table :rooms do |t| t.string :name, :null => false t.integer :capacity, :null => false t.boolean :phone, :null => false, :default => true t.boolean :projector, :null => false, :default => true t.timestamps end create_table :people do |t| t.string :fullname, :null => false t.string :email, :null => false t.boolean :active, :null => false, :default => 1 t.timestamps end create_table :reservations do |t| t.references :person t.references :room t.datetime :starttime, :null => false t.integer :duration, :null => false, :default => 60 t.string :title t.timestamps end I updated the model classes to reflect this I think, though I wonder if that might be incorrect: Reservation.rb has_one :person has_one :room validates_presence_of :person_id, :room_id Room.rb belongs_to :reservation validates_uniqueness_of :name validates_presence_of :name, :capacity validates_numericality_of :capacity Person.rb belongs_to :reservation validates_presence_of :fullname, :email validates_uniqueness_of :fullname, :email I was surprised to find that the scaffold didn''t create select lists for me based on the other referenced model objects. It seemed that collection_select was the right way to build a select based on other model objects, so I added the following line to the ReservationsController#new method: @occupants = Person.find(:all, :conditions => "active = 1", :order =>"fullname") And the following to new.html.erb <%= f.collection_select(''person_id'', @occupants, :id, :fullname) %> The rendered page now correctly displays the dropdown, but I get the following error on page submit and no idea why. I don''t know where the nil is or why it would reference the erb instead of the controller here. Also, if there''s a better way to have the scaffold build out the controls correctly, please let me know. I''m happy to send the rest of the source if anyone likes - just say so. Thanks - Reuben NoMethodError in Reservations#create Showing reservations/new.html.erb where line #8 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occurred while evaluating nil.map Extracted source (around line #8): 5: <% form_for(@reservation) do |f| %> 6: <p> 7: <b>Room</b><br /> 8: <%= f.collection_select(''person_id'', @occupants, :id, :fullname) %> 9: </p> 10: <p> 11: <b>Starttime</b><br /> RAILS_ROOT: /Users/reub/dev/projects/rails/squat Application Trace | Framework Trace | Full Trace /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:180:in `options_from_collection_for_select'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:366:in `to_collection_select_tag'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:118:in `collection_select'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:413:in `collection_select'' app/views/reservations/new.html.erb:8:in `_run_erb_47app47views47reservations47new46html46erb'' app/views/reservations/new.html.erb:5:in `_run_erb_47app47views47reservations47new46html46erb'' app/controllers/reservations_controller.rb:61:in `create'' app/controllers/reservations_controller.rb:55:in `create'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:180:in `options_from_collection_for_select'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:366:in `to_collection_select_tag'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:118:in `collection_select'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:413:in `collection_select'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:248:in `fields_for'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:184:in `form_for'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:637:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:637:in `compile_and_render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1100:in `render_for_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:858:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:872:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/layout.rb:262:in `render_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:131:in `call'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:131:in `custom'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:156:in `call'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:156:in `respond'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:150:in `each'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:150:in `respond'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:107:in `respond_to'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/rails.rb:76:in `process'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/rails.rb:74:in `synchronize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/rails.rb:74:in `process'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:159:in `process_client'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:158:in `each'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:158:in `process_client'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `initialize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `new'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:268:in `initialize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:268:in `new'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:268:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/configurator.rb:282:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/configurator.rb:281:in `each'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/configurator.rb:281:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/bin/mongrel_rails:128:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/command.rb:212:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/bin/mongrel_rails:281 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:180:in `options_from_collection_for_select'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:366:in `to_collection_select_tag'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:118:in `collection_select'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_options_helper.rb:413:in `collection_select'' app/views/reservations/new.html.erb:8:in `_run_erb_47app47views47reservations47new46html46erb'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:248:in `fields_for'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/helpers/form_helper.rb:184:in `form_for'' app/views/reservations/new.html.erb:5:in `_run_erb_47app47views47reservations47new46html46erb'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:637:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:637:in `compile_and_render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:365:in `render_template'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_view/base.rb:316:in `render_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1100:in `render_for_file'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:858:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:872:in `render_with_no_layout'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/layout.rb:262:in `render_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:51:in `render'' app/controllers/reservations_controller.rb:61:in `create'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:131:in `call'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:131:in `custom'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:156:in `call'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:156:in `respond'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:150:in `each'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:150:in `respond'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/mime_responds.rb:107:in `respond_to'' app/controllers/reservations_controller.rb:55:in `create'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache'' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi'' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/rails.rb:76:in `process'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/rails.rb:74:in `synchronize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/rails.rb:74:in `process'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:159:in `process_client'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:158:in `each'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:158:in `process_client'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `initialize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `new'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:285:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:268:in `initialize'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:268:in `new'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel.rb:268:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/configurator.rb:282:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/configurator.rb:281:in `each'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/configurator.rb:281:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/bin/mongrel_rails:128:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/lib/mongrel/command.rb:212:in `run'' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.2/bin/mongrel_rails:281 /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in `load'' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/mongrel.rb:64 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in'' /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require'' /usr/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'' script/server:3 Request Parameters: {"reservation"=>{"title"=>"", "starttime(1i)"=>"2008", "starttime(2i)"=>"1", "starttime(3i)"=>"2", "person_id"=>"1", "starttime(4i)"=>"13", "duration"=>"60", "starttime(5i)"=>"39"}, "commit"=>"Create", "authenticity_token"=>"6a26c519d59574a518725c680dc2c807a649fb1e"} Show session dump --- :csrf_id: b2092cbbc4e6a890d7827acb4fc3e27f flash: !map:ActionController::Flash::FlashHash {} Response Headers: {"cookie"=>[], "Content-Type"=>"text/html", "Cache-Control"=>"no-cache"} -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
@occupants is nil, meaning you haven''t defined it. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Reuben Kabel
2008-Jan-03 03:28 UTC
Re: NME, collection_select - Solution, possible rails issue?
Ryan Bigg wrote:> @occupants is nil, meaning you haven''t defined it.Possibly, but I don''t think so. When I render the page, it lists all the people that match the criteria in this line: @occupants = Person.find(:all, :conditions => "active = 1", :order => "fullname") I think I figured out what''s going on though. I wonder if this is might be a problem in rails. I commented out the following line in the reservations.rb model: validates :person_id, :rooms_id It then worked. I then uncommented it and in addition to the above, followed the same pattern to define @rooms in the ReservationsController and another collection_select in the view and lo and behold it works too. This seems pretty inconsistent though. First, with only the validation in the model, but no fields on the view form for either person or room, I get a flash error telling me about the missing fields. If I add one of the fields, I get a stack trace page, complaining about a nil somewhere. If I add both, it works great. What gives? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---