couchbase-ruby-model icon indicating copy to clipboard operation
couchbase-ruby-model copied to clipboard

Support ActiveRecord callbacks

Open alexanderedge opened this issue 11 years ago • 2 comments

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?

alexanderedge avatar Aug 30 '13 21:08 alexanderedge

Easy enough to do manually:

define_model_callbacks :save, :create before_save :func before_create :func

stakach avatar Oct 29 '13 07:10 stakach

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.

mje113 avatar Oct 29 '13 11:10 mje113