On 17 October 2010 06:17, Evanoshki Brataslavainskinski <[email protected]> wrote: > Luke Cowell wrote in post #954878: >> Did you try Michael's suggestion of adding this to your controller? >> >> helper_method :find_first_in_group >> >> This probably isn't the best approach, but you could change line 5 to >> something like this: >> <% @image_url = Camera.find_first_group_image(camera.camtype)%>
It is generally not considered good practice to access model methods directly from the view. Possibly a better way would be to define an instance method, image_url, in the Camera class. Then you could say <%= link_to(image_tag(camera.image_url)) %> Colin -- 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.

