如何跳过active_record 回调
1 def self.clear_superclass_callbacks
2 [:before_create,:after_create,:after_update,:before_destroy].each do |callback|
3 class_eval <<-"end_eval"
4 def self.#{callback}_callback_chain
5 @#{callback}_callbacks || CallbackChain.new
6 end
7 end_eval
8 end
9 end
10
11 clear_superclass_callbacks
2 [:before_create,:after_create,:after_update,:before_destroy].each do |callback|
3 class_eval <<-"end_eval"
4 def self.#{callback}_callback_chain
5 @#{callback}_callbacks || CallbackChain.new
6 end
7 end_eval
8 end
9 end
10
11 clear_superclass_callbacks
莫愁前路无知己,天下无人不识君。