开发者

vote_fu_rails_3 issue

I'm having trouble with a plugin on a rails 3 app called vote_fu_rails_3. This is a rails 3 compatible version of vote_fu by peteonrails. Both plugins are inspired by acts_as_voteable.

I have a site you can look at http://rubeddit.heroku.com - it's a reddit clone for a class i'm doing.

I am trying to get voting working. I have setup everything according to the instructions on the github page. I have a Link model that has_many :votes and my vote model has belongs_to :user and belongs_to :link.

When trying to do the method to vote_for a link by trying <%= link_to 'up', @user.vote_for(@link) %> I get a SQLite constraint error that voteable_id cannot be NULL.

You can see my code here am i doing something incorrectly? I'm open to any suggestions, i'm pretty new with rails.

Edit: The m开发者_如何学编程ain issue i'm having seems to stem from voteable_id and voteable_type. These are from polymorphic associations. Since I only have the need to vote on Links (a single model) I guess I have the option of removing the polymorphic associations. Leaving them in place however would also make allowing Comments (yet to be added) to be voted on, fairly simple.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜