module Authlogic::Session::ActiveRecordTrickery::ClassMethods

Public Instance Methods

human_attribute_name(attribute_key_name, options = {}) click to toggle source

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

authlogic.attributes.user_session.login
# 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) click to toggle source

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

authlogic.models.user_session
# 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
i18n_scope() click to toggle source
# File lib/authlogic/session/active_record_trickery.rb, line 40
def i18n_scope
  I18n.scope
end
lookup_ancestors() click to toggle source
# File lib/authlogic/session/active_record_trickery.rb, line 44
def lookup_ancestors
  ancestors.select { |x| x.respond_to?(:model_name) }
end
model_name() click to toggle source

For rails >= 3.0

# File lib/authlogic/session/active_record_trickery.rb, line 32
def model_name
  if defined?(::ActiveModel)
    ::ActiveModel::Name.new(self)
  else
    ::ActiveSupport::ModelName.new(self.to_s)
  end
end