Ruby on Rails Wednesday, March 2, 2016

Mahcsig wrote in post #1181846:
> def feed
> following_ids = current_user.following_users.map(&:id)
> following_ids << current_user.id
> @following_activities =
> Post.where(user_id:following_ids).order("created_at
> desc").paginate(page:params[:page])
> end
>
>
> ~Mahcsig

I'm getting an error for the user's avatar image. For whatever reason,
it's not seeing the full user model with attributes included. I'm using
Carrierwave btw.

<%= link_to(image_tag(user.avatar.url(:thumb), style: 'text-decoration:
none;', class: 'round-image-50'), user_path(user)) %>

undefined method `avatar' for #<Post:0xe2e9138>

But, I see that it is loading the information within the instance
variables.

--
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/f244e1213dc6348c31ccc3a24b168f1c%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment