Class User
before_save :set_searchable
def set_searchable
self.searchable = true if self.status == :active
end
end
>> u = User.last
>>
The documentation say
If a before_* callback returns false, all the later callbacks and the associated action are cancelled. If an after_* callback returns false, all the later callbacks are cancelled. Callbacks are generally run in the order they are defined, with the exception of callbacks defined as methods on the model, which are called last.
you might want to check this out ( I have tested this myself and the issue is 100% authentic)
Plus also there is bug related to before_save you might want to know check the comment over here
As said in the comment it is observed sometimes.
Whatever you do just be aware of that there are some issues with rails callback. This would save your time when you ran into one of those