Jordan Warbelow-Feldstein
Jordan Warbelow-Feldstein

Reputation: 10748

Rails 4: Surpress after_create callback

I'm trying to do the equivalent of Rails 3's Model.send(:create_without_callbacks) in Rails 4, but cannot find a working means of doing so.

A common method in Rails 3 of calling .skip_callback() and .set_callback() doesn't work here, as .set_callback() doesn't exist in Rails 4.

Upvotes: 0

Views: 866

Answers (1)

Ruby Racer
Ruby Racer

Reputation: 5740

If I got this right, then you can achieve that with a lambda definition, like this:

after_create :your_method, :if => lambda{ --your true/false set of conditions-- }

Upvotes: 1

Related Questions