Sha256: c6035fabe98b6a73608f376ab78b442d164d05f0de95f177a6beaf2b4b32fae4

Contents?: true

Size: 516 Bytes

Versions: 27

Compression:

Stored size: 516 Bytes

Contents

class LocalAgent
  include ActiveModel::Validations
  include ActiveModel::Conversion
  extend ActiveModel::Naming

  attr_accessor :username, :full_name, :address, :email

  def initialize(attributes = {})
    if attributes[:username]
      user = User.where(username: attributes[:username]).first
      if user
        send('email=', user.email)
      end
    else
      attributes.each do |name, value|
        send("#{name}=", value)
      end
    end
  end

  def persisted?
    false
  end

  def id
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
enju_biblio-0.3.4 spec/dummy/app/models/local_agent.rb
enju_biblio-0.3.3 spec/dummy/app/models/local_agent.rb
enju_biblio-0.3.2 spec/dummy/app/models/local_agent.rb
enju_biblio-0.3.1 spec/dummy/app/models/local_agent.rb
enju_biblio-0.3.0 spec/dummy/app/models/local_agent.rb
enju_biblio-0.3.0.rc.1 spec/dummy/app/models/local_agent.rb
enju_biblio-0.3.0.beta.2 spec/dummy/app/models/local_agent.rb