I have the following model that uses the plugin act_as_voteable:
class Video < ActiveRecord::Base
attr_accessible :url, :title, :description, :vote_count
validates_presence_of :url, :title, :description
I also have an observer for Vote model, so each time a user cast a vote
video, or other content, I will update some info, including the
on video model or other content. The code that runs each time a vote is
def update_user_points_and_votes_count(vote, factor)
content_clazz = Kernel.const_get(vote.voteable_type)
content.vote_count +=1*factor content.save! ... ...
Basically, I will update vote_count when a vote is casted to a video, or
other kind of content that act_as_voteable.
The problem is that the instruction content.save! raises a validation
exception on :url (in the list of validates_presence_of). I think that
will fail also on the other attributes in the list of
What I’m missing?