Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

if/unless option for callbacks #6

Closed
langalex opened this issue Oct 5, 2009 · 2 comments
Closed

if/unless option for callbacks #6

langalex opened this issue Oct 5, 2009 · 2 comments
Labels

Comments

@langalex
Copy link
Owner

langalex commented Oct 5, 2009

allow something like after_create :do_something, :if => :do_it?

should also work with a lambda instead of a symbol as condition

@kazjote
Copy link

kazjote commented Aug 18, 2010

I reimplemented callbacks in http://github.com/kazjote/couch_potato/commit/7ae9a51e0d836992df356fb259b3ae1f3824a09e using activemodel which provides if/unless functionality.

Whole testcase is unmodified (except for
spec/callbacks_spec.rb) and passes.

The code is much shorter and and will be even more if I modify specs to reflect new code base.

I think that there is no point in not using activemodel as dependency. Community put much effort in extracting activemodel and now it is really simple and awesome.

If you agree on accepting my changes I will change the specs too and make pull request.

@langalex
Copy link
Owner Author

great work. i'll pull this next week, when i have returned from traveling.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants