hello all, I'm trying to get my feet wet with a small webapp but it's getting frustrating to put together all the pieces of the REST/CRUD/restful controllers/composite views (composite meaning with more than 1 resources in the view). So to make the problem concrete I have the following models
1. class Deal < ActiveRecord::Base 2. belongs_to :Restaurant 3. belongs_to :Location 4. ... 5. end 6. 7. class Location < ActiveRecord::Base 8. belongs_to :Restaurant 9. end 10. 11. class Restaurant < ActiveRecord::Base 12. has_many :Location 13. has_many :Deal 14. ... 15. end
In my mind each of these models corresponds to a resource, so each model come with its controller and its 7 CRUD controller actions, and the route mappings in routes.rb.
Up till now restful design is adhered (I think). What buffles me is how to present information from these 3 models (or any number of models, for that matter) in a single (composite) view and still remain RESTful? Use of partials and a dedicated controller with 1 action (without an underlying model) in order to present these resources in a single view doesn't seem very restful to me. Regardless of REST, is the above solution (partials and dedicated controller) a valid RoR approach?
I read somewhere that REST makes more sense in a web services scenario than a UI webapp. How much of this is true?
Regarding the resource generator: it scaffolds a model and an empty controller. Does this make any sense when the Rails take on REST tends to associate a resource with an ActiveRecord model, or a model/ controller stack? I mean, where are the CRUD actions? The scaffold generator scaffolds a restful controller and the views, which I do not want since I need composite screens.
sigh and thank you