I'm a bit stuck.
I want to return my posts and my followed_users posts.
I have a association called "followed_users" so I am able to call @user.followed_users
<% for friends in current_user.followed_users %>
<% for post in friends.posts %>
<%= post.body %>
<% end %>
<% end %>
This works, however only for "followed_users" posts. I also want to include my posts. So my plan is first check for my post then loop through all to see which belongs to my followed_users.
My implementation is returning my post but not all of followed_users.
Am I on the right track?
<% for post in Post.all %>
<% if post.user_id == current_user.id ||
for friends in current_user.followed_users
for post in friends.posts
end
end %>
<li>
<%= post.user.name %>
<%= post.body %>
</li>
<% end %>
<% end %>