Module: Authlogic::Session::ActiveRecordTrickery::ClassMethods
- Defined in:
- lib/authlogic/session/active_record_trickery.rb
Instance Method Summary collapse
-
#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:.
-
#human_name(*args) ⇒ Object
How to name the class, works JUST LIKE ActiveRecord, except it uses the following namespace:.
- #i18n_scope ⇒ Object
- #lookup_ancestors ⇒ Object
-
#model_name ⇒ Object
For rails >= 3.0.
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.login
18 19 20 21 22 |
# File 'lib/authlogic/session/active_record_trickery.rb', line 18 def human_attribute_name(attribute_key_name, = {}) [:count] ||= 1 [:default] ||= attribute_key_name.to_s.humanize I18n.t("attributes.#{name.underscore}.#{attribute_key_name}", ) 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 |
#i18n_scope ⇒ Object
40 41 42 |
# File 'lib/authlogic/session/active_record_trickery.rb', line 40 def i18n_scope I18n.scope end |
#lookup_ancestors ⇒ Object
44 45 46 |
# File 'lib/authlogic/session/active_record_trickery.rb', line 44 def lookup_ancestors ancestors.select { |x| x.respond_to?(:model_name) } end |
#model_name ⇒ Object
For rails >= 3.0
32 33 34 35 36 37 38 |
# 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 |