Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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.
  • Loading branch information...
commit 2a7a33eaaf7c8191d120fde28a2f5bfeb0080a8f 1 parent cbd8c9a
@drogus drogus authored
View
1  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
View
9 actionpack/test/template/record_identifier_test.rb
@@ -37,4 +37,13 @@ def test_dom_class
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
Please sign in to comment.
Something went wrong with that request. Please try again.