Reputation:
Please bear with me as I am having difficulty phrasing this question.
I am trying to learn and implement a vote functionality in a rails app, I am using the activerecord-reputation-system gem.
I have successfully been able to implement this functionality in my a users show view the issue I have is in my micropost feed.
when a user is signed in he/she is re-directed to the home page which now has a micropost feed this is where I want to put the voting links but it just isn't working.
Do I have to define voting routes for the home page controller? like I did for the micropost
resources :microposts, only: [:create, :destroy] do
member { post :vote}
end
or what??
routes are included in original post, plan on using post method. this is what i have for my links:
<% if current_user?(micropost.user) && !current_user.voted_for?(micropost) %>
| <%= link_to "up", vote_micropost_path(micropost, type: "up"), method: "post" %>
| <%= link_to "down", vote_micropost_path(micropost, type: "down"), method: "post" %>
<%= link_to "Delete", micropost, method: :delete,
data: { confirm: "You sure?" },
title: micropost.quote %>
<% end %>
Upvotes: 2
Views: 84
Reputation: 6931
Check this great Active Record Reputation System railscast.
ryanb goes through activerecord-reputation-system gem and builds from scratch solution.
Upvotes: 1