Sha256: a6a0eea890f3c17789761d0befaa71d6791cd43141572a41207c387d82c8c3eb

Contents?: true

Size: 523 Bytes

Versions: 5

Compression:

Stored size: 523 Bytes

Contents

class NoPassword::Model
  include ActiveModel::Model
  include ActiveModel::Validations::Callbacks
  extend ActiveModel::Naming

  def initialize(*args, **kwargs)
    super(*args, **kwargs)
    assign_defaults
  end

  protected
  # Subclasses would implement default assignments in the subclass.
  def assign_defaults
  end

  # When we're dealing with t/f values, the ||= doesn't work, so we set those
  # defaults up here.
  def assign_default(attr, val)
    self.send("#{attr}=", val) if self.send(attr).nil?
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nopassword-0.1.5 app/models/nopassword/model.rb
nopassword-0.1.4 app/models/nopassword/model.rb
nopassword-0.1.3 app/models/nopassword/model.rb
nopassword-0.1.2 app/models/nopassword/model.rb
nopassword-0.1.0 app/models/nopassword/model.rb