Extend model.save method Rails -
can take .save method of activerecord models , add functionality it? use of attributes of item being saved in function
can like?
class item < activerecord::base     def self.save         <added stuff save>         <including some_other_id_from_this_item>     end end   or break things? , how access this_item.the_column_i_need?
you should use activerecords callbacks extend behavior of save.
with before_save hook can access data before record saved, example change case of entered email can like
class user < activerecord::base   before_save :downcase_email    def downcase_email     email.downcase!   end end      
Comments
Post a Comment