Is there a way to make a before_save conditional?

you can use :if

before_save do_something, :if => Proc.new {|model| model.some_boolean_attr_or_method }

or simply

before_save do_something, :if => some_condition

EDIT:

for a quick reference, there’s an excellent guide about this:

http://guides.rubyonrails.org/active_record_callbacks.html#conditional-callbacks

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)