I have an iPhone version of my site, and for some reason none of the
rjs works when viewing the iPhone version. This happens instead:
ActionView::MissingTemplate (Missing template controller_name/
update.erb in view path app/views)
The rjs works fine when viewing the site normally, and it worked when
viewing the iPhone version prior to upgrading Rails to 2.3.2.
Additional info: I have 'Mime::Type.register_alias "text/
html", :iphone' in mime_types.rb and the respond_to block in the
action is what'd you expect --
No one knows why this is happening? I created a new rails app from
scratch, first uncommenting "Mime::Type.register_alias "text/
html", :iphone" in mime_types.rb. Then I put this in my application
controller:
There are no errors whatsoever, however the rjs doesn't get executed
at all, even with Firebug showing the js in the response. Surely
someone can help with this?
The problem would appear to be that you've got your iphone mime-type
defined as text/html. This means that even though Rails is correctly
processing the RJS file, it is telling the browser that the file is
HTML, not JavaScript. You'll need a separate type (iphone_js or
something) defined as text/javascript.
Thanks for the advice; it worked fine pre-2.3 though. I added
"Mime::Type.register_alias "text/javascript", :iphonejs" to
mime_types.rb and put "format.iphonejs" in the respond_to block, but
now I get a 406 Not Acceptable error. Am I doing it wrong?
Thanks for the advice; it worked fine pre-2.3 though.
I'm not sure why this would ever have worked, but then again MIME type
mapping is one of my weak spots in Rails.
I added
"Mime::Type.register_alias "text/javascript", :iphonejs" to
mime_types.rb and put "format.iphonejs" in the respond_to block, but
now I get a 406 Not Acceptable error.
Did you restart the server? If I remember correctly, defined MIME types
are only loaded at server startup.
Am I doing it wrong?
You must be, since you're not getting the right result.
But I'm not sure where the problem is, if restarting the server doesn't
do the trick.
I made a new app and I started from scratch. After following the steps
in my previous posts, I still get 406 errors. This is so strange; it
seems like I'm the only one in the world having this problem with 2.3!
Anything else I can do?