[Rails] Re: undefined method + method(argument)
Michael Pavling wrote in post #954819:
> On 16 October 2010 15:46, Evanoshki Brataslavainskinski
> So you've added a method to your controller, and you want to call that
> method from a view? If so, you need to define it as a "helper method"
> in the controller:
>
> helper_method :find_first_in_group
>
> BUT... without a bit more information, it's not possible to say for
> sure, but it's possible that it would be more appropriate to put the
> method in a model as a class method. But hard to say with what you've
> given us.
>
>> In other programming languages it would be something like:
>> find_first_in_group(image_url).
>
> In Ruby it's exactly the same - although it's common to drop the
> parentheses ;-)
Thanks to Michael Pavling for guiding me in the right direction
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home