I'm have a little question, anybody please answer. I generate form with formtastic something like this
semantic_form_for @some, :url => {:action =>:do_something}
it generates me the action for form like this: /some/2/do_something
I want it to generate action like this: /some/2/do_something?#code
How can I do this?
Formtastic's semantic_form_for
wraps around Rails' form_for
, which, under the hood, uses standard Rails URL helpers and conventions. In this case, the convention you're probably interested in is URL generation from hashes like {:action => "bah" }, in which case you should check out the Rails documentation on url_for
, which allows for an :anchor
option:
url_for(:action => "foo", :anchor => 'bah')
# => /testing/foo#bah
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.