I am working on a Rail 3 project. I have a model below (it uses a paperclip to upload an image)
class diagram & lt; ActiveRecord :: Base has_and_belongs_to_many: categories has_attached_file: pict ,: styles = & gt; {: Small = & gt; "150x150>" } Validates_attachment_presence: Pict is valid _attachment_size: pict ,: less_than = & gt; 5.Magabyte is valid_datetime_type_type: picture ,: content_type = & gt; ['Image / jpeg', 'image / png', 'image / gif'] end In its index.html.erb, I added a "link_to" to delete the record , But the following does not work:
'image_path' for under-defined method # # Class: 0x10549f560>>: 0x10549d940 & gt; Excluded sources (around line # 16): 8: & lt; Table class = "gallery" & gt; 9: & lt; Tr & gt; 10: & lt;% i = 0% & gt; 11: & lt;% @ pictures.each do | Picture | & Gt%; 12: & lt;% if i% 4 == 0 then% & gt; 13: & lt; / Tr & gt; & Lt; Tr & gt; 14: & lt;% end% & gt; 15: & lt; Td> & Lt;% = link_to image_tag (image picture.val (small)), image picture.url% & gt; & Lt; / Td> 16: & lt; Td> & Lt;% = link_to image_tag ("delete.png"), picture ,: confirmation => 'Are you sure?' ,: method = & gt; :% & Gt; & Lt; / Td> 17: & lt;% i = i + 1% & gt; 18: & lt;% end% & gt; 19: & lt; / Tr & gt; I already use a very similar line (16) for another model and I do not have this error.
Can you please help?
Thanks and Regards,
Luke
That you are missing 'photos in your own way RB file .....
Resource: Picture
Comments
Post a Comment