How could you do it, in a *RESTful* way? I have a very simple model with 2 attrs and each view is a Model.find_all_by_attr1 and _attr2. How is this modeled in REST? I''ve been in rails for 6 months now and REST is continuing giving me headaches and tbh, it seems to me that it''s unsuitable for user centric applications, where the same information could be presented in many different ways. index and show simply wouldn''t cut it as it seems to me that they are tightly coupled to a more DB-centric approach. (Where is index fit into REST, if REST is based on CRUD? Can''t I have an "index2 or index_by_whatever_criteria_I_want, and still be RESTful? ) Of course, decision logic could be moved to the view layer but that seems like a regression to MVC. Im tempted to stop thinking in REST terms and simply move on; Maybe I just need a good reason to convince myself. thank you --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
map.resources can take additional specifications for either member-level methods (operating on a single instance of the model), or collection-level methods (operating on a collection). You can extend your routes in a RESTful fashion to your hearts content. http://api.rubyonrails.org/classes/ActionController/Resources.html -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 11, 10:31 am, Bill Vatikiotis <vvatikio...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> How could you do it, in a *RESTful* way? > > I have a very simple model with 2 attrs and each view is a > Model.find_all_by_attr1 and _attr2. How is this modeled in REST?Usually I do this by specifying the view/filtering criteria as query parameters: myapp.com/models?attr1=val1&attr2=val2 This calls the index action, and with params[:attr1] = val1 and params [:attr2] = val2> I''ve been in rails for 6 months now and REST is continuing giving me > headaches and tbh, it seems to me that it''s unsuitable for user > centric applications, where the same information could be presented in > many different ways. index and show simply wouldn''t cut it as it seems > to me that they are tightly coupled to a more DB-centric approach. > > (Where is index fit into REST, if REST is based on CRUD? Can''t I have > an "index2 or index_by_whatever_criteria_I_want, and still be > RESTful? )Index and Show are both from the R of CRUD.> Of course, decision logic could be moved to the view layer but that > seems like a regression to MVC. > > Im tempted to stop thinking in REST terms and simply move on; Maybe I > just need a good reason to convince myself. > > thank youDoes this help at all? The Rails conventions don''t work 100% of the time, but for me it works 95% of the time - I just have to think a bit sometimes about what my action is accomplishing, and challenge myself on why one on the 7 actions *wouldn''t* suffice. Jeff purpleworkshops.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thank you all. It''s still difficult to REST my brain but I''ll get there eventually --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---