O'Reilly logo

Learning Rails: Live Edition by Edd Dumbill, Simon St. Laurent

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

Escaping the REST Prison

While REST is extremely powerful, developers used to working in other environments may be cursing at this point, wondering whether they really need to build every part of their application according to this weird new paradigm.

Don’t worry: you don’t have to. You could, if you wanted, stick with the GET/POST approach shown in earlier chapters. Rails doesn’t enforce RESTfulness.

However, you may want to explore a combination of approaches. If a page is only ever going to be reached with GET, use a simple controller and view or even a static page where appropriate. If a page needs to manage more sophisticated data input and output, then use REST to simplify that process. In a more complex application, it might make sense to use REST for cases where data is coming in or being edited, and to use simpler controllers for situations where the application is just presenting information.

The remainder of this book is going to use the combination approach. REST is just too convenient for getting structured data in and out of a website to ignore, but when REST isn’t necessary, there’s no need to let it dominate.

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