I seek clarification on using the thumbs up gem with rails 4. I current have a user resource and a post resource and have set up thumbs up as follows.
add gem to gemfile and installed it using bundler. Generated require migration
User model
class User < ActiveRecord::Base
acts_as_voter
end
Post model
class Post < ActiveRecord::Base
acts_as_voteable
end
Post controller
def vote_up
@post = Post.find(params[:id])
current_user.vote_for(@post)
respond_to do |format|
format.js
end
end
View
<%= link_to('vote for this post!', vote_up_post_path(@post) , :method => :post) %>
Route file
resources :posts do
member do
post :vote_up
end
end
However i keep getting this error
No route matches [POST] "/posts/vote_up"
And after running rake routes I can see that the following route is available to me:
vote_up_post POST /posts/:id/vote_up(.:format) posts#vote_up
any ideas what could be the cause of this error ?
Could you please show us your view.
Apparently, you are calling
instead of