Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Save active_record without calling callbacks in rails3 [duplicate]

Possible Duplicate:
How can I avoid running ActiveRecord callbacks?

In rails 2 there was a private method on active_records called create_without_callbacks which you could call to save a record into the database without triggering the callbacks associated with that object. This method has disappeared in rails 3, is there any way to achieve the same thing?

like image 593
opsb Avatar asked Oct 25 '10 13:10

opsb


1 Answers

You are preventing certain business logic from happening when you'd call create_without_callbacks. Consider removing the callbacks if they are not needed, or use the :if and :unless options to trigger the callback only when needed.

like image 180
Ariejan Avatar answered Oct 13 '22 01:10

Ariejan