If I add something to a model’s create method
note.rb
def self.create p
p 'in self.create'
super p
end
user.rb
has_many :notes
It gets run whenever I call Note.create. But if I call create on an association, like current_user.notes.create, it doesn’t get run. Why is that?
To redefine association
createmethod you can pass a block with newcreatemethod tohas_manyassociation:user.rb: