Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #5596 from lest/patch-3

apply form_for namespace option to date_select
  • Loading branch information...
commit 3f1b8c6a95fcdcdc14ecd0f6fe1758a1e1044269 2 parents ed7567c + bd8a970
@drogus drogus authored
View
5 actionpack/lib/action_view/helpers/date_helper.rb
@@ -940,7 +940,10 @@ def input_name_from_type(type)
# Returns the id attribute for the input tag.
# => "post_written_on_1i"
def input_id_from_type(type)
- input_name_from_type(type).gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '')
+ id = input_name_from_type(type).gsub(/([\[\(])|(\]\[)/, '_').gsub(/[\]\)]/, '')
+ id = @options[:namespace] + '_' + id if @options[:namespace]
+
+ id
end
# Given an ordering of datetime components, create the selection HTML
View
8 actionpack/test/template/form_helper_test.rb
@@ -960,6 +960,14 @@ def test_form_for_with_namespace
assert_dom_equal expected, output_buffer
end
+ def test_form_for_with_namespace_with_date_select
+ form_for(@post, :namespace => 'namespace') do |f|
+ concat f.date_select(:written_on)
+ end
+
+ assert_select 'select#namespace_post_written_on_1i'
+ end
+
def test_form_for_with_namespace_with_label
form_for(@post, :namespace => 'namespace') do |f|
concat f.label(:title)
Please sign in to comment.
Something went wrong with that request. Please try again.