On 16 July 2010 20:31, RichardOnRails
<richarddummymailbox58...@uscomputergurus.com> wrote:
>> Post back if you have any more problems.
> Thanks for your generous offer.  So here's my last (I hope) stumbling
> block. I got:
>
>  NoMethodError in Expenses#new
>
> Showing app/views/expenses/new.html.erb where line #14 raised:
>
> undefined method `merge' for :nickname:Symbol
>
> Extracted source (around line #14):
>
> 11:     <%# New version of vendor selection -%>
> 12:     <% params[:expense] = 10 -%>
> 13:     <% @vendors = Vendor.find( :all, :order=>"nickname ASC") -%>
> 14:     <%= f.collection_select(:vendor, :id,
> @vendors, :id, :nickname) %>
> 15:     <%# End of New version -%>
> 16:
> 17:     <%#= f.collection_select(:vendor, @vendors, :id, :nickname) %>
>
> But the claim about nickname being bogus seems suspicious to me.  For
> one thing:
>
>>> Vendor.find(:first)
> => #<Vendor id: 62, nickname: "vendor 5/15/2010", qbname: "Test new
> field names", [snip]
>
> And the arguments seem to agree with
> http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html,
> particularly the guidance for the public instant method:
>
> collection_select(object, method, collection, value_method,
> text_method, options = {}, html_options = {})

If you use collection_select on its own you need to pass the object,
but f.collection_select inside a form_for takes the object from
form_for.

The documentation is a bit confusing in that area.

Colin

>
> Any ideas?
>
> Thanks in Advance,
> Richard
>
>
> On Jul 16, 11:58 am, Andy Jeffries <a...@andyjeffries.co.uk> wrote:
>> > >  Welcome to dynamic objects and classes :-)
>> > Thanks.  This restores my faith in Rails and enhances my appreciation
>> > of newsgroups, especially this one.
>> > Now I've got to put them to use!
>>
>> Good luck.
>>
>> Post back if you have any more problems.
>>
>> Cheers,
>>
>> Andy
>
> --
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> 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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to