Ruby on Rails
Tuesday, July 31, 2012
On Monday, 30 July 2012 23:25:45 UTC-4, Me wrote:
Is there something I need to do to the data_type to make it recognize it as a method?
wrong number of arguments (3 for 0)
<div class="control-group"> 48: <%= f.label question.name.to_sym, :class => 'control-label' %> 49: <div class="controls"> 50: <%= question.data_type "person[person_question_ids][]
", question.id, nil %> - <%= ' allergic to shellfish?' %> 51: </div> 52: </div>
Wait, what? You posted the correct code in your original post, but this isn't that code. Line 50 here is saying, "call the data_type method on the question object with these three parameters". The generated accessor doesn't understand the parameters, and you get the error.
If you want to call a method whose name is selected at runtime, you *need* to use send.
--Matt Jones
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/HtXEgsuq8MEJ.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment