I have the same problem
yes, @microposts declared in the show controller method as:
def show @user = User.find(params[:id]) @microposts = @user.microposts.paginate(page: params[:page]) end
Update: I found that the show action is defined twice (one of them defines @microposts ). To solve this problem, I simply deleted the second show action, which @microposts does not detect. I wonder how several people could duplicate the action of the show.
source share