diff options
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 |