Skip to content

Commit

Permalink
Merge pull request binarylogic#204 from benmanns/rails3-i18n.
Browse files Browse the repository at this point in the history
Rails3 i18n
  • Loading branch information
binarylogic committed Apr 30, 2011
2 parents cfd65d6 + 77532c4 commit 006f25a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/authlogic/session/active_record_trickery.rb
Expand Up @@ -46,6 +46,14 @@ def model_name
::ActiveSupport::ModelName.new(self.to_s)
end
end

def i18n_scope
I18n.scope
end

def lookup_ancestors
ancestors.select { |x| x.respond_to?(:model_name) }
end
end

module InstanceMethods
Expand Down
10 changes: 10 additions & 0 deletions test/session_test/active_record_trickery_test.rb
Expand Up @@ -19,6 +19,16 @@ def test_self_and_descendents_from_active_record
def test_self_and_descendants_from_active_record
assert_equal [UserSession], UserSession.self_and_descendants_from_active_record
end

def test_i18n_of_human_name
I18n.backend.store_translations 'en', :authlogic => {:models => {:user_session => "MySession" } }
assert_equal "MySession", UserSession.human_name
end

def test_i18n_of_model_name_human
I18n.backend.store_translations 'en', :authlogic => {:models => {:user_session => "MySession" } }
assert_equal "MySession", UserSession.model_name.human
end
end

class InstanceMethodsTest < ActiveSupport::TestCase
Expand Down

0 comments on commit 006f25a

Please sign in to comment.