diff options
author | Piotr Sarnacki <drogus@gmail.com> | 2012-08-25 13:34:52 +0200 |
---|---|---|
committer | Piotr Sarnacki <drogus@gmail.com> | 2012-08-28 11:19:37 +0200 |
commit | f4d493ed7c451f3df7602c5164a1954caa40284e (patch) | |
tree | 5d272ddd5c54ae164620bf104895943f38dc087b /actionpack | |
parent | 8eb4600c881f55370663f3a6225271d9cdc7bdbd (diff) | |
download | rails-f4d493ed7c451f3df7602c5164a1954caa40284e.tar.gz rails-f4d493ed7c451f3df7602c5164a1954caa40284e.tar.bz2 rails-f4d493ed7c451f3df7602c5164a1954caa40284e.zip |
Fix ActionView::RecordIdentifier to work as a singleton
We extend it with self, but the methods were not working properly were
used directly on module.
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/lib/action_view/record_identifier.rb | 1 | ||||
-rw-r--r-- | actionpack/test/template/record_identifier_test.rb | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/record_identifier.rb b/actionpack/lib/action_view/record_identifier.rb index 0d44145231..2953654972 100644 --- a/actionpack/lib/action_view/record_identifier.rb +++ b/actionpack/lib/action_view/record_identifier.rb @@ -27,6 +27,7 @@ module ActionView # same naming convention and allows you to write less code if you follow it. module RecordIdentifier extend self + extend ModelNaming include ModelNaming diff --git a/actionpack/test/template/record_identifier_test.rb b/actionpack/test/template/record_identifier_test.rb index a7f1420059..22038110a5 100644 --- a/actionpack/test/template/record_identifier_test.rb +++ b/actionpack/test/template/record_identifier_test.rb @@ -37,4 +37,13 @@ class RecordIdentifierTest < ActiveSupport::TestCase def test_dom_class_with_prefix assert_equal "custom_prefix_#{@singular}", dom_class(@record, :custom_prefix) end + + def test_dom_id_as_singleton_method + @record.save + assert_equal "#{@singular}_1", ActionView::RecordIdentifier.dom_id(@record) + end + + def test_dom_class_as_singleton_method + assert_equal @singular, ActionView::RecordIdentifier.dom_class(@record) + end end |