On 2 March 2016 at 21:43, David Williams <lists@ruby-forum.com> wrote:
> Iterating over the @following_activities instance variable is giving me
> errors for user.avatar.url and user.post. I don't understand why it's
> not collecting all of the information from the user object.
>
> <% if @following_activities.any? %>
> <% @following_activities.each do |user| %>
In the code you posted earlier the activities are Post objects not
User objects. Possibly you want
@following_activities.each do |post|
and then post.user.photo.... etc
Colin
> <%= link_to(image_tag(user.avatar.url(:thumb), style:
> 'text-decoration: none;', class: 'round-image-50-trendy-warrior'),
> user_path(user)) %>
> <%= user.post.username %>
> <%= user.post.body %>
> <%= image_tag(user.post.photo.url(:medium), style: '') %>
> <% end %>
> <% else %>
> <h1>No new posts</h1>
> <% end %>
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8a06021c43b603b07ed4c52ff1e36142%40ruby-forum.com.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLs9R-Tp72ycO435b2N%2BvX_QNkRZ7QnXv%3DOYMJr564eQng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment