couchbase-ruby-model
couchbase-ruby-model copied to clipboard
Support ActiveRecord callbacks
Couchrest-model supports the following callbacks:
:before_validation, :after_validation, :after_initialize, :before_create, :around_create, :after_create, :before_destroy, :around_destroy, :after_destroy, :before_save, :around_save, :after_save, :before_update, :around_update, :after_update
However, couchbase-ruby-model doesn't seem to support them all since I am receiving the following error:
undefined method 'before_validation' for User(id):Class (NoMethodError)
Would it be possible to add the missing callbacks?
Easy enough to do manually:
define_model_callbacks :save, :create before_save :func before_create :func
All the remaining callbacks were added here: https://github.com/couchbase/couchbase-ruby-model/commit/631e3d1f490fd8b39ad011cfb3a5ab1fbd19c39a So they're available in master--waiting on a new version for them to make it into the gem release.