Help on ruby on rails for mobile website development

hi all,

     I am trying to implement a website on the mobile device. The website is written in RoR and currently runs for desktop and laptop users. I have started learning RoR with Instant Rails. Could anyone guide me about how should i move forward, like any references, what points to consider for designing?

Thanks and Regards, Sattu

Sattu wrote:

hi all,

     I am trying to implement a website on the mobile device. The website is written in RoR and currently runs for desktop and laptop users. I have started learning RoR with Instant Rails. Could anyone guide me about how should i move forward, like any references, what points to consider for designing?

Okay, here are the basics to get you started. As you may or may not know there was a time when rails templates used the .rhtml extension. Beginning with Rails 2.0 (I think) templates began using a new naming convention such as .html.erb. This change separates the engine (erb in this case) from the markup (html).

The primary reason for this change was to provide an elegant solution for just what you're trying to accomplish.

The heart of the solution is wrapped up in the respond_to method of Rails controllers. You might have seen something similar to the following:

def index   @people = Person.find(:all)

  respond_to do |format|     format.html     format.xml { render :xml => @people.to_xml }   end end

In order to support other templates using HTML you would add your own "format" and MIME type.

So the respond_to could be extended to include the alternate "mobile" layouts:

def index   @people = Person.find(:all)

  respond_to do |format|     format.html     format.mobile     format.iphone     format.xml { render :xml => @people.to_xml }   end end

With these MIME types added in order to inform Rails of the new types:

Robert Walker wrote:

You can then use the ACCEPTS header or URL extension just like you would for the XML representation:

http://localhost:3000/posts.mobile http://localhost:3000/posts/1.iphone etc.

Oops. These URL should have been for people rather than posts to match the rest of the example:

http://localhost:3000/people.mobile http://localhost:3000/people/1.iphone etc.

Hi Sattu,

hi all,

     I am trying to implement a website on the mobile device. The website is written in RoR and currently runs for desktop and laptop users.

If I understand your question correctly, I'd recommend that you google 'web design for mobile devices' as a starting point. You'll also need to learn to identify user agents and, more importantly, to identify client capabilities. CSS and Javascript will become important tools in your kit. If you're not already fluent in those, focus some effort on becoming so.

HTH, Bill

Sattu wrote:

hi all,

     I am trying to implement a website on the mobile device. The website is written in RoR and currently runs for desktop and laptop users. I have started learning RoR with Instant Rails. Could anyone guide me about how should i move forward, like any references, what points to consider for designing?

Thanks and Regards, Sattu

It may be that your website will already work well in mobile browsers. Check before you do any further development.

And for God's sake, if you do have to make a mobile site, provide a link to the full site. Some of us really hate crippled functionality.

Best,

Marnen Laibow-Koser wrote:

And for God's sake, if you do have to make a mobile site, provide a link to the full site. Some of us really hate crippled functionality.

+1