Sha256: d5e991c76d262fb57532c5d8866458429556fb8c978b9d163f1f70a5f1b5bfdd
Contents?: true
Size: 684 Bytes
Versions: 15
Compression:
Stored size: 684 Bytes
Contents
require "mobility/active_model/backend_resetter" module Mobility module ActiveRecord =begin Backend resetter for ActiveRecord models. Adds hook on +reload+ event to {Mobility::ActiveModel::BackendResetter}. =end class BackendResetter < Mobility::ActiveModel::BackendResetter # @param [Class] model_class Class of model to which backend resetter will be applied def included(model_class) model_reset_method = @model_reset_method mod = Module.new do define_method :reload do |*args| super(*args).tap { instance_eval(&model_reset_method) } end end model_class.include mod end end end end
Version data entries
15 entries across 15 versions & 1 rubygems