mongoid counter_cache
Em vez de criar vários callbacks nos modelos mongoid, use o recurso counter_cache. class Foo include Mongoid::Document has_many :bars field :bars_count, type: Fixnum, default: 0endclass Bar include Mongoid::Document belongs_to :foo, …
Continuar lendo