I know DHH said anything can fit into the seven actions if you think about it enough but, my current delimma has me thinking otherwise. So I''m doing an internal messaging system. The user will have an inbox, sent, deleted etc. To show these I need to query the data in different ways. Messages.find(:all, :conditions => ["to_user_id = ?, @me] for inbox, and so on. Any thoughts on how I can make this RESTful? More models perhaps? filters? Thanks. -- 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 -~----------~----~----~----~------~----~------~--~---
On Aug 22, 2006, at 12:19 PM, Guest wrote:> So I''m doing an internal messaging system. The user will have an > inbox, > sent, deleted etc. To show these I need to query the data in different > ways. > > Messages.find(:all, :conditions => ["to_user_id = ?, @me] for > inbox, and > so on. > > Any thoughts on how I can make this RESTful? More models perhaps? > filters?I would have thought your example was a perfectly RESTful thing to do, probably in your messages controller. Providing your user authentication complies with HTTP standards, then scoping your queries isn''t necessarily un-RESTful. James. -- James Stewart : Freelance Web Developer Work : http://jystewart.net Play : http://james.anthropiccollective.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
So you''re saying call a before_filter on the index action or something? James Stewart wrote:> On Aug 22, 2006, at 12:19 PM, Guest wrote: >> filters? > I would have thought your example was a perfectly RESTful thing to > do, probably in your messages controller. > > Providing your user authentication complies with HTTP standards, then > scoping your queries isn''t necessarily un-RESTful. > > James. > > > -- > James Stewart : Freelance Web Developer > Work : http://jystewart.net > Play : http://james.anthropiccollective.org-- 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 -~----------~----~----~----~------~----~------~--~---
For the authentication, yes. I see that a RESTful authentication plugin was just released (haven''t had a chance to try it yet): http://www.agilewebdevelopment.com/plugins/restful_authentication James. On Aug 22, 2006, at 1:28 PM, Guest wrote:> So you''re saying call a before_filter on the index action or > something? > > James Stewart wrote: >> On Aug 22, 2006, at 12:19 PM, Guest wrote: >>> filters? >> I would have thought your example was a perfectly RESTful thing to >> do, probably in your messages controller. >> >> Providing your user authentication complies with HTTP standards, then >> scoping your queries isn''t necessarily un-RESTful. >> >> James.-- James Stewart : Freelance Web Developer Work : http://jystewart.net Play : http://james.anthropiccollective.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I''m acutally using that plugin. It''s great! I''m not really having trouble with that though. I''m wondering how I should do the search for either sent, received, or deleted messages, based on who''s logged in, in a RESTful manner. Without the REST stuff, I would have probably had three separate actions: get_sent_messages get_received_messages get_deleted_messages That doesn''t fit into the whole REST seven actions thing though. I want to show three different views of the data, sent, received or deleted. Thanks James. James Stewart wrote:> For the authentication, yes. > > I see that a RESTful authentication plugin was just released (haven''t > had a chance to try it yet): > > http://www.agilewebdevelopment.com/plugins/restful_authentication > > James. > > > On Aug 22, 2006, at 1:28 PM, Guest wrote: >>> scoping your queries isn''t necessarily un-RESTful. >>> >>> James. > > -- > James Stewart : Freelance Web Developer > Work : http://jystewart.net > Play : http://james.anthropiccollective.org-- 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 -~----------~----~----~----~------~----~------~--~---
On Aug 22, 2006, at 3:07 PM, Guest wrote:> I''m acutally using that plugin. It''s great! > > I''m not really having trouble with that though. I''m wondering how > I should do the search for either sent, received, or deleted > messages, based on who''s logged in, in a RESTful manner. > > Without the REST stuff, I would have probably had three separate > actions: > > get_sent_messages > get_received_messages > get_deleted_messages > > That doesn''t fit into the whole REST seven actions thing though. I > want to show three different views of the data, sent, received or > deleted.That depends whether you''d consider the different status messages as distinctly different resources, or whether those methods are simply different conditions. If they''re different kinds of resources, you should probably use separate controllers for each. If it''s options for what to display, you could consider using a query string: /messages/?status=sent or you _could_ add extra methods, so long as they map to methods map.resources :messages, :collection => { :sent => :get, :received => :get, :deleted => :get } which I believe would give you: /messages/;sent /messages/;received /messages/;deleted James. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---