views:

76

answers:

1

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.mobile.erb doesn't exist. How to fallback to some_action.html.erb rather than an error page.

+2  A: 

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.