Skip to content

Commit

Permalink
fix TypeError when using submit_tag with Symbol value
Browse files Browse the repository at this point in the history
  • Loading branch information
y-yagi committed Dec 23, 2015
1 parent 552e4e6 commit 621ed49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion actionview/lib/action_view/helpers/form_tag_helper.rb
Expand Up @@ -447,7 +447,7 @@ def submit_tag(value = "Save changes", options = {})
unless tag_options["data-disable-with"] == false || (tag_options["data"] && tag_options["data"][:disable_with] == false)
disable_with_text = tag_options["data-disable-with"]
disable_with_text ||= tag_options["data"][:disable_with] if tag_options["data"]
disable_with_text ||= value.clone
disable_with_text ||= value.to_s.clone
tag_options.deep_merge!("data" => { "disable_with" => disable_with_text })
else
tag_options["data"].delete(:disable_with) if tag_options["data"]
Expand Down
7 changes: 7 additions & 0 deletions actionview/test/template/form_tag_helper_test.rb
Expand Up @@ -510,6 +510,13 @@ def test_submit_tag_doesnt_have_data_disable_with_twice
)
end

def test_submit_tag_with_symbol_value
assert_dom_equal(
%(<input data-disable-with="Save" name='commit' type="submit" value="Save" />),
submit_tag(:Save)
)
end


def test_button_tag
assert_dom_equal(
Expand Down

0 comments on commit 621ed49

Please sign in to comment.