#6 new

view file extensions

Reported by huberto | April 27th, 2009 @ 05:11 PM

i noticed after adding this to application_controller.rb:


rails will now look for files with extension .erb instead of .html.erb

because of this rails can no longer find files in the app. for example, my app-wide layout application.rhtml will always fail on this call

render :partial => 'users/user_bar'

it looks for users/user_bar.erb and complains about a missing template because the file is actually located at users/user_bar.html.erb.


Comments and changes to this ticket

  • Brendan G. Lim

    Brendan G. Lim April 27th, 2009 @ 05:27 PM

    Since, you're forcing true, it will always look for this extension regardless of what browser they are accessing your site from:


    You should use has_mobile_fu instead of has_mobile_fu(true) since the second one I mentioned is just used for testing, unless that's what you were planning on doing.

  • Chuong Huynh

    Chuong Huynh September 26th, 2009 @ 04:41 PM

    No, actually the problem is:

    When use has_mobile_fu(true), or if the request has been recognized as from mobile device, render will look for .erb file, not .html.erb. I'm using haml, and it doesn't work as well - it keep looking for .erb view.

    Thing works fine if request is not from .mobile.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Want to automatically detect mobile devices that access your Rails application? Mobile Fu allows you to do just that. People can access your site from a Palm, Blackberry, iPhone, Nokia, etc. and it will automatically adjust the format of the request from :html to :mobile.