ESPNDev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jul-22 22:16 UTC
Re: REST w/ multiple views
Hey Mike On Jul 22, 1:05 pm, "Mike Joslyn" <seamonkeydo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I have app that will need to be able to display records matching a search > criteria. What is the RESTful way to do this? Just an plain index action > with search parameters? Should the query parameters be built into the route?That''s how I would do it. Ideally you''ll have a Search object so that it makes writing search rules more modular and results aren''t session- based (and you can share them across users). Definitely include the parameters in the URL if for no other reason because you''ll strengthen your google juice.> Additionally, the records themselves will have multiple views associated > with them, ie: html & graphs, but all via a webpage. Would responds_to be > the proper way to approach this?Well, for different representations responds_to is definitely the way to go (json, xml, etc). You can define a custom responds_to as this guy did for the iphone (http://blog.marcslove.com/2007/6/29/respond_to- iphone-in-rails). Users could call http://yoursite.com/whatever.graph Alternatively you could create a Graph scaffold and allow users to access http://yoursite.com/graphs/whatever If this is too vague let me know and I''ll try to help out further... ESPNDev --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
ESPNdev - thanks alot for the info. Da-da-da Da-da-da! On Tue, Jul 22, 2008 at 6:16 PM, ESPNDev-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org < ESPN3.DL-CommunityDev-xX8xgfAcNKEAvxtiuMwx3w@public.gmane.org> wrote:> > Hey Mike > > On Jul 22, 1:05 pm, "Mike Joslyn" <seamonkeydo...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I have app that will need to be able to display records matching a search > > criteria. What is the RESTful way to do this? Just an plain index action > > with search parameters? Should the query parameters be built into the > route? > > That''s how I would do it. Ideally you''ll have a Search object so that > it makes writing search rules more modular and results aren''t session- > based (and you can share them across users). Definitely include the > parameters in the URL if for no other reason because you''ll strengthen > your google juice. > > > Additionally, the records themselves will have multiple views associated > > with them, ie: html & graphs, but all via a webpage. Would responds_to be > > the proper way to approach this? > > Well, for different representations responds_to is definitely the way > to go (json, xml, etc). You can define a custom responds_to as this > guy did for the iphone (http://blog.marcslove.com/2007/6/29/respond_to- > iphone-in-rails<http://blog.marcslove.com/2007/6/29/respond_to-iphone-in-rails>). > Users could call http://yoursite.com/whatever.graph > > Alternatively you could create a Graph scaffold and allow users to > access http://yoursite.com/graphs/whatever > > If this is too vague let me know and I''ll try to help out further... > > ESPNDev > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Mike, If you can, also check out the Rails Recipes book. One of the recipes is how to write a search controller and actions that are modular and can be shared across multiple other controllers. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---