开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜