Sha256: 9f66ab477b9443265662177189aba8dec4dd1273954016ee18965e547448feb2
Contents?: true
Size: 464 Bytes
Versions: 1
Compression:
Stored size: 464 Bytes
Contents
module Forest module HasRepeatable extend ActiveSupport::Concern class_methods do def has_repeatable(attribute, options = {}) serialize attribute, Array before_save :"remove_blank_#{attribute}" define_method(:"remove_blank_#{attribute}") do self.send(attribute).reject! { |a| a[:key].blank? && a[:value].blank? } end end end end end ActiveRecord::Base.send(:include, Forest::HasRepeatable)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
forest_cms-0.98.1 | lib/forest/rails/active_record/has_repeatable.rb |