<%= image_tag (complaint.image) %> This line breeds this error, Can't resolve image into URL: to_model delegated to attachment, but the attachment is nil Without the image_tag, I get an active_storage object; #, how then do I get past this
Just check if its nil before displaying the image.
<%= image_tag(complaint.image) if complaint.image %>
Also do NOT put a space between the method name and the parens in Ruby. Since parens are optional in Ruby it will be treated as a single argument and not a list of arguments.
foo (bar, baz) # causes a syntax error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.