Sha256: 71a1192afd8500e38120811a80633103afdfae7c0ad05a2e3b0f7d5b81c2ce62

Contents?: true

Size: 291 Bytes

Versions: 4

Compression:

Stored size: 291 Bytes

Contents

module BMC::DefaultValuesConcern
  extend ActiveSupport::Concern

  def assign_default_values
  end

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

  included do
    after_initialize :assign_default_values, if: :new_record?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bmc-1.6.1 app/models/concerns/bmc/default_values_concern.rb
bmc-1.6.0 app/models/concerns/bmc/default_values_concern.rb
bmc-1.5.1 app/models/concerns/bmc/default_values_concern.rb
bmc-1.5.0 app/models/concerns/bmc/default_values_concern.rb