Class: Amalgam::Authorities::Models::ActiveRecord

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
Amalgam::Authorities::Model
Defined in:
lib/amalgam/authorities/models/active_record.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Amalgam::Authorities::Model

#authenticate, included

Instance Attribute Details

#current_passwordObject

Returns the value of attribute current_password.



10
11
12
# File 'lib/amalgam/authorities/models/active_record.rb', line 10

def current_password
  @current_password
end

#loginObject

Returns the value of attribute login.



10
11
12
# File 'lib/amalgam/authorities/models/active_record.rb', line 10

def 
  @login
end

Class Method Details

.locate(content) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/amalgam/authorities/models/active_record.rb', line 21

def self.locate(content)
  query = []
  Amalgam.authority_keys.each do |key|
    query << "#{key.to_s} = :value"
  end
  where([query.join(" OR "),{:value => content}]).first
end

Instance Method Details

#admin?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/amalgam/authorities/models/active_record.rb', line 17

def admin?
  Amalgam.authorities[self.class.model_name.underscore.to_sym] == :admin
end