Sha256: 121110b72d5e1fd3b4b5cf3605e03c2fef515a0484da884c3d69b542da74b62a
Contents?: true
Size: 497 Bytes
Versions: 8
Compression:
Stored size: 497 Bytes
Contents
module PhModel module Concerns module AttributeOfArrayTypeInitialization extend ActiveSupport::Concern included do |other| other.after_initialize :initialize_array_type_attributes end def initialize_array_type_attributes self.class.attributes.each do |attribute_name, info| if info[:type].kind_of?(Array) send("#{attribute_name}=", []) unless send(attribute_name).present? end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems