0
votes

I have a method on a model called Photo. I have it finding a selection of things from elsewhere in my app. All I need it to do at the end is to create a string of links that I can then output later on when the method is called on an instance.

My code is:

cars.map { |c| link_to(c.name, c) }.join(" AND ")

But i'm hitting this error:

undefined method `link_to' for #<Photo

Any ideas how to fix this?