Sha256: 72e6b3df552c8f20322e50d43272bb533852752ec268d1dcb203ae2c00e93cb0
Contents?: true
Size: 422 Bytes
Versions: 2
Compression:
Stored size: 422 Bytes
Contents
module AutoSet module ActiveRecord extend ActiveSupport::Concern module ClassMethods def auto_set(column, parents, options = {}) before = (parents.is_a?(Hash) ? parents : options).delete(:before) callback = [:save, :create, :validation].include?(before) ? :"before_#{before}" : :before_save self.send callback, SetColumn.new(column, parents, options) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
auto_set-1.2.1 | lib/auto_set/active_record.rb |
auto_set-1.2.0 | lib/auto_set/active_record.rb |