Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
arjun menon
903 Pointsdisplay uploaded image in "all feed" page??
i cannot display the uploaded image document with the created status update in the 'all feed page" however, i was able to get it work in the show status page. modified this way in show.html.erb:
<% if @status.document && @status.document.attachment? %>
<%= image_tag @status.document.attachment.url(:medium) %><br />
<%= status_document_link @status %>
<hr />
<% end %>
putting the same code in the index.html.erb page generates:
NoDocument Method error for document
any suggestion how to go about it?? thnx in advance
2 Answers
Jason Seifer
Treehouse Guest TeacherHey arjun menon you may need to say "status" instead of "@status". Hope that helps!
arjun menon
903 Pointsnope that didnt work. was still getting d same error. but when i modified the application helper file to
def status_document_link(status)
if status.document && status.document.attachment?
content_tag(:span, "Attachment", class: "label label-info") +
link_to(image_tag(status.document.attachment.url(:medium)), status.document.attachment.url)
end
end
then it worked. wud appreciate explanation as to why that worked.