How to fix error in rails 7 action view helper?

264 views Asked by At

I'm getting this error ("wrong number of arguments (given 1, expected 0)") in the following helper.

module PropertiesHelper
        def property_thumbnail
          img = property.photo.present? ? property.photo.thumb.url : "placeholder.png"
          image_tag img, class: "property_thumb"
        end
end
1

There are 1 answers

0
Sameer Valsangkar On

In your Property Controller

helper_method :property_thumbnail

def property_thumbnail
   img = property.photo.present? ? property.photo.thumb.url : "placeholder.png"
   image_tag img, class: "property_thumb"
end