O'Reilly logo

Head First Rails by David Griffiths

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. XML and Multiple Representations: It all looks different now...

image with no caption

You can’t please everyone all of the time. Or can you? So far we’ve looked at how you can use Rails to quickly and easily develop web apps that perfectly fit one set of requirements. But what do you do when other requirements come along? What should you do if some people want basic web pages, others want a Google mashup, and yet more want your app available as an RSS feed? In this chapter you’ll create multiple representations of the same basic data, giving you the maximum flexibility with minimum effort.

Climbing all over the world

Head First Climbers is a web site for mountaineers all over the world. Climbers report back from expeditions to record the locations and times of mountains they have climbed, and also to report dangerous features they’ve discovered, like rock slides and avalanches.

image with no caption

The information is obviously very important for the safety of other climbers, and many climbers use mobile phones and GPS receivers to read and record information straight from the rock face. Used in the right way, the system will save lives and yet—somehow—the web site’s not getting a lot of traffic.

So why isn’t it popular?

The application is very basic. It’s simply a scaffolded version of this data structure:

Incident

mountain ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required