I want get from a method ruby true if every posts are followed for a people and false if not.
I have this method:
def number_of_posts_that_are_followed
user_to_be_followed = User.find(params[:id]) #users whose posts, will be followed by another user
user_to_be_followed.posts.each do |this_post|
if current_user.follows?(this_board) == true #method that returns true if the current_user is following this post of the user whose posts will be followed
return true
else
return false
end
end
end
The problem is that this method return true if the first post (in the first iteration) its followed by current_user. I want return true if every posts are followed or false if not are followed.
I have tried put a count like this:
count = user_to_be_followed.posts.count