Quantcast
Channel: User Schwern - Stack Overflow
Viewing all articles
Browse latest Browse all 581

Answer by Schwern for add after_save callback on the instance level

$
0
0

You can accomplish this with a normal callback which looks for a special flag on the instance.

class MyModel << ActiveRecord::Base  after_save do    MyWorker.perform_async(self.id) if @perform_my_worker_after_save  end  def some_stuff    self.foo = "bar"    @perform_my_worker_after_save = true  endend

Viewing all articles
Browse latest Browse all 581

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>