I have made a similar post to this one before, however I decided to repost it as a more general purpose question to elicit the views of the Rails community. I have been trying to design an application in Ruby on Rails using a REST style, however I am getting stuck on the issue of pages that need to display multiple resources, for instance a home page that has many different resource on that page, or a page that has both hotel rooms and advertisements. I posted a question like this before on the group and got an interesting reply as the first response (http:// groups.google.com/group/rubyonrails-talk/browse_thread/thread/ 8653e9f0047170df), saying in part that Rails doesn't seem to have good support for this style of interaction at the moment, and this seems to be true as far as I can tell. So I have a number of questions, to see if I can get some general opinions: 1. Is it true that Rails does not support this type of interaction? 2. Does REST in general support this? 3. Does this mean that most general purpose websites can not be written according to a REST style? 4. Should Rails support this type of interaction if it doesn't already? 5. In the case of Rails and nested resources, what happens when a parent has multiple children? How does one expose this in Rails? Thanks for your time.
on 2007-05-29 00:42
on 2007-05-29 10:22
on 2007-05-30 15:57
The Rails development philosophy is more of a guideline rather than a hard rule. You don't need to develop in REST if it is not appropriate for your site. I have developed many non-REST Rails applications that mix unrelated models on the same page. If it's what the customer wants - the customer gets :) Though not recommended, you can even make Active Record calls from your View rather than your Controller. Both Ruby and Rails are flexible enough to stray outside of the conventional to solve problems. I have more recently been toying with the idea that REST can be used more as client/server development where you could basically have two applications working together to solve a problem. The underlying RESTful application manages the data and web services while another non-RESTful application manages the presentation layer of your web application. It would be interesting to see if anyone has tried this approach. Cheers, Chris Matthieu http://www.Rubyology.com