ruby on rails - How can you override the activerecord has_many assoication build method? -
i override build method of has_many assoication.
class otherthings < activerecord::base belongs_to :my_model end class mymodel < activerecord::base has_many :other_things end
such that
m = mymodel.create m.other_things.build # i'd add additional logic within build method...
i have gone updating new method of otherthings, getting little messy. i'd logic happen when being associated hence build...
im unsure of trying build. if trying add more methods attach .whatever_method end. also, models associated.
Comments
Post a Comment