 <p>You should change this to before_save, that way you can change the model's attributes, and then they will be saved to the database as normal. </p> <pre><code>class Slot include Mongoid::Document before_save :calculate_period def calculate_period if condition #do something end end end </code></pre>