So I'm trying to create a facebooky kinda of site to learn rails. And so
i have a User class and a micropost class. Those are simple and I know
how that all works. The micropost points to its user and all that fun
stuff. But then i have a feed controller where i want to display ALL the
microposts and then I want to click on them to view them. I set up the
feed controller to view them and all that works. But then I also want
for any person to be able to "like" or "dislike" a micropost. The
micropost class has a like and a dislike variable in them. So I defined
a like and dislike action in the feed controller and set that all up.
The way its looks is kinda like this.
@post = Micropost.find(params[:id])
@user = User.find(@post.user_id)
respond_to do |format|
The routes file looks like this
match "feed/:id/like" =>"feed#like"
match "feed/:id/dislike" =>"feed#dislike"
To me, this should all work correctly. And it did when I did the methods
in the console, so i'm not worried about that. The problem is that the
post will save, but the user will not. And i'm not sure why. Any