开发者

Is it against the Restful Rails route default to submit page back to itself

Here's the scenario of out of the box map.resources

I'm on /users/new Submit -> /users/ rescue error render new URL: is /users/

If User.index never defined. I copy the URL to another tab, it'll have routing error.

How can I have the URL showing /users/new while activerecord err开发者_运维问答ors persists on the page?


This is a common issue with rails restful routes.

What happens is you are on /users/new and when you submit if there is an error it simply does

render :action => 'new' 

This causes your POST route to still show in the address bar but render the action new. When you try to copy this URL it is invalid.

The guys over at expected behavior have a fix on github for this that takes advantage of html5

http://github.com/expectedbehavior/fix_you_some_address_bar

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜