Use the before_create filter.
class RsEvaluation < ActiveRecord::Base before_create :update_value def update_value self.value = rand(5..12) end end
Nonetheless; Since Evaluation is not your own model, but another from the library, try opening a class and fixing it:
module ReputationSystem class Evaluation < ActiveRecord::Base before_create :update_value def update_value self.value = rand(5..12) end end end
This will be placed in your config/initializers folder.
source share