Module: Authlogic::Session::ActiveRecordTrickery::ClassMethods

Defined in:
lib/authlogic/session/active_record_trickery.rb

Instance Method Summary collapse

Instance Method Details

#human_attribute_name(attribute_key_name, options = {}) ⇒ Object

How to name the attributes of Authlogic, works JUST LIKE ActiveRecord, but instead it uses the following namespace:

authlogic.attributes.user_session.


18
19
20
21
22
# File 'lib/authlogic/session/active_record_trickery.rb', line 18

def human_attribute_name(attribute_key_name, options = {})
  options[:count] ||= 1
  options[:default] ||= attribute_key_name.to_s.humanize
  I18n.t("attributes.#{name.underscore}.#{attribute_key_name}", options)
end

#human_name(*args) ⇒ Object

How to name the class, works JUST LIKE ActiveRecord, except it uses the following namespace:

authlogic.models.user_session


27
28
29
# File 'lib/authlogic/session/active_record_trickery.rb', line 27

def human_name(*args)
  I18n.t("models.#{name.underscore}", {:count => 1, :default => name.humanize})
end

#self_and_descendants_from_active_recordObject

For Rails >2.3, fix mispelling



37
38
39
# File 'lib/authlogic/session/active_record_trickery.rb', line 37

def self_and_descendants_from_active_record
  [self]
end

#self_and_descendents_from_active_recordObject

For rails < 2.3, mispelled



32
33
34
# File 'lib/authlogic/session/active_record_trickery.rb', line 32

def self_and_descendents_from_active_record
  [self]
end