I have been working on a form that would use javascript to validate the
data before submitting it, and from my view.rhtml I have a statement
like this:
However such a statement generates a HTML tag that looks like this:
Seems like Rails thinks it is a parameter instead of an option, so what
I tried next was something like:
Sadly that doesn’t compile. From rubydocs the syntax for form_tag is
form_tag(url_for_options = {}, options = {}, *parameters_for_url), so
how do I specify the options that I’d want as in this case?
Sadly that doesn’t compile. From rubydocs the syntax for form_tag is
form_tag(url_for_options = {}, options = {}, *parameters_for_url), so
how do I specify the options that I’d want as in this case?
Just had the same problem. You need to use parentheses around all of
the arguments:
P.S. I realize this is old, but I found it so I figured I’d pass it on
for others.
Correct. The problem is ruby has a hard time distinguishing between
passed hashes, and associated blocks tacked onto method calls. Using
parens fixes the issue since hashes would be isnside the parens, and
blocks would be outside.
Sadly that doesn’t compile. From rubydocs the syntax for form_tag is
form_tag(url_for_options = {}, options = {}, *parameters_for_url), so
how do I specify the options that I’d want as in this case?
Just had the same problem. You need to use parentheses around all of
the arguments:
Sadly that doesn’t compile. From rubydocs the syntax for form_tag is
form_tag(url_for_options = {}, options = {}, *parameters_for_url), so
how do I specify the options that I’d want as in this case?
Just had the same problem. You need to use parentheses around all of
the arguments:
P.S. I realize this is old, but I found it so I figured I’d pass it on
for others.
Correct. The problem is ruby has a hard time distinguishing between
passed hashes, and associated blocks tacked onto method calls. Using
parens fixes the issue since hashes would be isnside the parens, and
blocks would be outside.