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:


environment.rb

Mime::Type.register “text/mobile”, :mobile
Mime::Type.register “text/iphone”, :iphone

Then your templates would be named accordingly:

index.mobile.erb
index.iphone.erb

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.

Then you simply use Embedded Ruby (erb) with HTML to create your mobile
and iphone (or any other alternate layouts) you want.

Robert W. 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.

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
http://www.marnen.org
[email protected]

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

Hi Sattu,

On Tue, 2009-09-08 at 20:08 -0700, 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.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs