I’m creating a new format for an iPhone/iPod connections.
My problem is that iPhones/iPods always receive the .html pages.
If I comment the format.html # index.html.erb then the devices receive
the .xml format, and If I coment this one they receive the format.iphone
wich is the expected.
In the .html pages I add some code to test if the device is really an
iPhone or not:
<% if iphone_user_agent? # Show message for iPhone users -%>
Perhaps you could change default route to point to index.iphone when you
use your subdomain. You’d then need to ensure all your links used the
.iphone extension.
Unless there is someway to force the default format from html to
‘iphone’? Wouldn’t surprise me if it was possible, however, you’d need
to look it up…
Perhaps you could change default route to point to index.iphone when you
use your subdomain. You’d then need to ensure all your links used the
.iphone extension.
Unless there is someway to force the default format from html to
‘iphone’? Wouldn’t surprise me if it was possible, however, you’d need
to look it up…
Cheers
Luke
Hello,
Do you mean to always use for example an iphone as an extension ?
Then I would to add some special route, don’t ?
And in the controller, split the actions:
index
index_iphone
but this approach forces to have duplicate methods, for example fetching
the same data in two different places, I can’t follow the DRY. I know at
least I must have differents views …
If the respond_to and format would work, it would be great …
I was not setting the format to iphone correctly in the application
controller, the iPhone format only was available if the user connects
from a subdomain iphone.mywebpage.com or via a custom parameter,
format=iPhone.
As I’m developing locally with the 127.0.0.1 I don’t have a quick-way to
simulate iphone.127.0.0.1 or something similar, so I change the method
and simply if the user connected is from an iPhone/iPod I show their
pages directly.
I’ll think in a better solution, but as this is for a test purposes, at
this moment it’s ok.
thanks,
r.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.