Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

more methods for before_validation

Is possible set 2 methods on before_validation in a model?

before_validation :elaborate
before_validation :download_remote_data, :if => :data_url_provided? 
like image 833
Luca Romagnoli Avatar asked Nov 26 '09 21:11

Luca Romagnoli


2 Answers

Yes, your code is fine. Just have in mind that elaborate method is going to be executed first (since it's registered before the download_remote_data method).

like image 121
Milan Novota Avatar answered Nov 19 '22 22:11

Milan Novota


That is certainly valid. You can add as many before_validation calls as you need.

like image 28
Thomas Brice Avatar answered Nov 19 '22 22:11

Thomas Brice