Sha256: 8f96a5f4ba3ddde5043fd5899cb454ad9fcda905d829a5ea764cd07fdfc60a47

Contents?: true

Size: 286 Bytes

Versions: 10

Compression:

Stored size: 286 Bytes

Contents

module Agilibox::DefaultValuesConcern
  extend ActiveSupport::Concern

  def assign_default_values; end

  def assign_default(attribute, value)
    self.send("#{attribute}=", value) if self.send(attribute).nil?
  end

  included do
    after_initialize :assign_default_values
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
agilibox-1.0.9 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.8 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.7 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.6 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.5 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.4 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.3 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.2 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.1 app/models/concerns/agilibox/default_values_concern.rb
agilibox-1.0.0 app/models/concerns/agilibox/default_values_concern.rb