On 4 August 2010 09:32, disruptive tech <[email protected]> wrote: > I'm also trying this: > > controller > ---------- > > def new > �...@usr = Usr.new > �...@country_list = Country.find(:all, :order=>"country_name") > respond_to do |format| > format.html # new.html.erb > format.xml { render :xml => @usr } > end > end > > and in view > ----------- > > <%= collection_select(:country, :id, @country_list, :id, :country_name, > options ={:prompt => "-Select a cnt"}, :class =>"country") %> > > I get the following on loading a new.html.erb > > 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
What happens if, rather than using collection select, you just display the id and country name for each item in @country list? Doing that will prove that the data is ok. I presume that the table has a country_name column. Colin > > Any ideas? Thanks > > B > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

