开发者

Rails response.format fallback?

A rails app has some files end with .mobile.erb, which is for iPhone.

There is before_filter which set request.format = :mobile by check the request.user_agent.

My question is below:

If some_action.mobi开发者_JAVA百科le.erb doesn't exist. How to fallback to some_action.html.erb rather than an error page.


I had the same problem and did some quick research. From what i could find rails fallbacks to some_action.erb if you have set the request.format to something it can't find. Haven't tested this thoroughly, but it's a start. It will however probably require you to retouch your files to action_name.erb.

Hope it helps.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜