app/models/user.rb
# Define a proto-feed.
# See "Following users" for the full implementation.
Define a proto-feed.
See "Following users" for the full implementation.
Define a proto - feed . See " Following users " for the full implementation .
def feed
    following_ids = "SELECT followed_id
                     FROM relationships
                     WHERE follower_id = :user_id"
    Micropost.where("user_id IN (#{following_ids})
                     OR user_id = :user_id", user_id: id)
  end
def feed following_ids = "SELECT followed_id
                     FROM relationships
                     WHERE follower_id = :user_id" Micropost . where ( "user_id IN (#{following_ids})
                     OR user_id = :user_id" , user_id : id ) end
Define a proto-feed.
Define a proto - feed .
# old - Micropost.where("user_id = ?", id) # feed for self and following #following_ids = "SELECT followed_id FROM relationships #                 WHERE follower_id = :user_id" #Micropost.where("user_id IN (#{following_ids}) #                 OR user_id = :user_id", user_id: id) # feed1- #Micropost.where("user_id IN (?) OR user_id = ?", following_ids, id) # feed2