How to generate right actions for html forms with formtastic?
I'm have a little question, anybody pl开发者_C百科ease 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
精彩评论