开发者

Vote Fu Rails App voting link help

开发者 https://www.devze.com 2023-03-20 07:05 出处:网络
I\'m having some trouble using the Vote Fu plugin for Rails 3.So far, I\'ve got all the voting features worked out (I can have Users vote for Articles successfully in the rails console).

I'm having some trouble using the Vote Fu plugin for Rails 3. So far, I've got all the voting features worked out (I can have Users vote for Articles successfully in the rails console).

The problem that I am having is that I cannot seem to get a link working on the front end. I hav开发者_如何学Ce the following in my Articles view so that Users can hopefully just click on a link to vote for the particular Article.

    <%= link_to image_tag('up.gif', :size => '50x50'), upvote_article_path(article), :method => put %>

When I try to run my app, I get an error that says:

SQLite3:: SQLException: no such column: score: SELECT SUM(score) AS sum_id FROM "votes" WHERE ("votes.voteable_id = 4 AND "votes".voteable_type = 'Article'

Does anyone have any advice on this matter? Any help would be greatly appreciated! Thank you!


Your table is not setup properly, try rake db:migrate. Did you use vote_fu's migration generator? Make sure you are using the rails 3 version if using rails 3 available here.

According to the docs:

Create vote_fu migration

Create a new rails migration using your new vote_fu generator (Note: "VoteableModel" is the name of the model on which you would like votes to be cast, e.g. Comment): rails g vote_fu VoteableModel

Run the migration: rake db:migrate

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号