Skip to content

Commit e8a7f49

Browse files
committed
[MODEL] Added callback in the activerecord_associations.rb example
1 parent 619e538 commit e8a7f49

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

elasticsearch-model/examples/activerecord_associations.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ class Category < ActiveRecord::Base
6868
class Author < ActiveRecord::Base
6969
has_many :authorships
7070

71+
after_update { self.authorships.each(&:touch) }
72+
7173
def full_name
7274
[first_name, last_name].compact.join(' ')
7375
end

0 commit comments

Comments
 (0)