I can sent my own action to a users_controller stating in routes.rb map.resources :users, :member => { :network => get } I defined in my users_controller the network action.... so I can have an url like "http://localhost:3000/users/168.xml;network" now I would like to have another action network_plus which is a little bit different fron the network.. sure, I can state another action..... but is there any possibility to use only one action and perform differently according to a parameter... how can I pass parameters to the network action ? "http://localhost:3000/users/168.xml;network&plus=true" .... is it correctly RESTFUL?..... thanks for your lights kad -- 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 5/10/07, Kad Kerforn <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I can sent my own action to a users_controller stating in routes.rb > map.resources :users, :member => { :network => get } > > I defined in my users_controller the network action.... > so I can have an url like > "http://localhost:3000/users/168.xml;network" > > now I would like to have another action network_plus which is a little > bit different fron the network.. > > sure, I can state another action..... but is there any possibility to > use only one action and perform differently according to a parameter... > > how can I pass parameters to the network action ? > "http://localhost:3000/users/168.xml;network&plus=true" .... is it > correctly RESTFUL?..... > > thanks for your lightsParameters need to start with a ?, and are separated by the &. .../168.xml;network?plus=true -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
Rick Olson wrote:> On 5/10/07, Kad Kerforn <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: >> >> sure, I can state another action..... but is there any possibility to >> use only one action and perform differently according to a parameter... >> >> how can I pass parameters to the network action ? >> "http://localhost:3000/users/168.xml;network&plus=true" .... is it >> correctly RESTFUL?..... >> >> thanks for your lights > > Parameters need to start with a ?, and are separated by the &. > > .../168.xml;network?plus=true > > > -- > Rick Olson > http://lighthouseapp.com > http://weblog.techno-weenie.net > http://mephistoblog.comthanks sorry for the typing mistake... so it''s so simple as url.... 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?hl=en -~----------~----~----~----~------~----~------~--~---
On May 10, 8:54 am, Kad Kerforn <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> sure, I can state another action..... but is there any possibility to > use only one action and perform differently according to a parameter... > > how can I pass parameters to the network action ? > "http://localhost:3000/users/168.xml;network&plus=true" .... is it > correctly RESTFUL?.....It''s ok to use the parameters to further "refine" your action, but just make sure that your custom action shouldn''t really be a standard action of another resource. It could very well be that although your "network" action seems to be needed on a user resource, perhaps you''re really stumbling upon a discovery of a new resource entirely. What does the network action try to do? And if you *had* to stick to the seven RESTful actions, what action would "network" be and for what resource? Those are the kinds of questions I ask myself whenever I feel like adding a custom action, and about half the time, I''m able to just declare a new resource and remove the custom action. Jeff softiesonrails.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 Thu, May 10, 2007 at 02:11:15PM -0000, Jeff wrote :> Those are the kinds of questions I ask myself whenever I feel like > adding a custom action, and about half the time, I''m able to just > declare a new resource and remove the custom action.+1. Actually, everything (authorizations, logins, search, ...) can be fit into the 7 REST actions. It''s just sometimes hard to figure out what sort of resource do you need. -- ,========================. | Pierre-Alexandre Meyer | | email : pam-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.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?hl=en -~----------~----~----~----~------~----~------~--~---
http://www.surfjunky.com/?r=Gabrielll chack this out :D it chaged my life style :) -- 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 -~----------~----~----~----~------~----~------~--~---
Is this URL correct? .../168.xml;network or should it actually be .../168;network.xml this always confuses me. Should the format extension always appear at very end of the URL, just before the query string. Before the semicolon before the custom action? On May 10, 10:20 am, Pierre-Alexandre Meyer <p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.org> wrote:> On Thu, May 10, 2007 at 02:11:15PM -0000, Jeff wrote : > > > Those are the kinds of questions I ask myself whenever I feel like > > adding a custom action, and about half the time, I''m able to just > > declare a new resource and remove the custom action. > > +1. > > Actually, everything (authorizations, logins, search, ...) can be fit into > the 7 REST actions. It''s just sometimes hard to figure out what sort of resource do you need. > > -- > ,========================. > | Pierre-Alexandre Meyer | > | email : p...-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.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?hl=en -~----------~----~----~----~------~----~------~--~---
On 5/10/07, Robert Walker <rwalker348-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Is this URL correct? > > .../168.xml;network > > or should it actually be > > .../168;network.xml > > this always confuses me. Should the format extension always appear at > very end of the URL, just before the query string. Before the > semicolon before the custom action?I think this was one of the reasons we changed it to / in edge rails. When we actually got to building real restful apps with custom actions, singleton resources, etc, it was clear using the semicolon wasn''t working out (plus, safari won''t send http basic auth with it). It should be /168/network.xml, which is a lot easier to grasp, provides a transparent migration to a singleton ''network'' resource should it be necessary, and doesn''t mess with caching. -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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 Thu, May 10, 2007 at 08:15:31AM -0700, Robert Walker wrote :> Before the semicolon before the custom action?Be careful, semicolon will be deprecated in Rails2.0 http://dev.rubyonrails.org/changeset/6485 -- ,========================. | Pierre-Alexandre Meyer | | email : pam-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.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?hl=en -~----------~----~----~----~------~----~------~--~---
Oh thank goodness. Great move! I''m looking forward to the release of this. I like that idea so much better. It also removes the confusion between http://localhost:3000/resource/new and http://localhost:3000/resource/:id;edit If you think about it they are both used to GET the form and not modify the resource. Yet "new" has a slash and "edit" has a semicolon. So I would love to write this instead: http://localhost:3000/resource/:id/edit And this will also make custom actions (when they are necessary) feel more like first class citizens in the URL. On May 10, 11:20 am, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 5/10/07, Robert Walker <rwalker...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Is this URL correct? > > > .../168.xml;network > > > or should it actually be > > > .../168;network.xml > > > this always confuses me. Should the format extension always appear at > > very end of the URL, just before the query string. Before the > > semicolon before the custom action? > > I think this was one of the reasons we changed it to / in edge rails. > When we actually got to building real restful apps with custom > actions, singleton resources, etc, it was clear using the semicolon > wasn''t working out (plus, safari won''t send http basic auth with it). > It should be /168/network.xml, which is a lot easier to grasp, > provides a transparent migration to a singleton ''network'' resource > should it be necessary, and doesn''t mess with caching. > > -- > Rick Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---
Rick Olson wrote:> On 5/10/07, Robert Walker <rwalker348-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> very end of the URL, just before the query string. Before the >> semicolon before the custom action? > > I think this was one of the reasons we changed it to / in edge rails. > When we actually got to building real restful apps with custom > actions, singleton resources, etc, it was clear using the semicolon > wasn''t working out (plus, safari won''t send http basic auth with it). > It should be /168/network.xml, which is a lot easier to grasp, > provides a transparent migration to a singleton ''network'' resource > should it be necessary, and doesn''t mess with caching. > > -- > Rick Olson > http://lighthouseapp.com > http://weblog.techno-weenie.net > http://mephistoblog.comcould be, but...... no route found to match "/users/168/network.xml" with {:method=>:get} no route found to match "/users/168;network.xml" with {:method=>:get} only http://localhost:3000/users/168.xml;network is correctly executed... also how shoudl I write the URL in my rxml ?, I wrote :dataURL => "http://localhost:3000/users/#{friend.id}.xml;network?from=#{@user.id}&level=#{@level}" which generates... dataURL="http://localhost:3000/users/126.xml;network?from=168&level=1" this URL accepted but u can see the "amp;level" parameter ??? params => {"format"=>"xml", "amp;level"=>"1", "from"=>"168", "amp"=>"", "level"=>"1", "action"=>"network", "id"=>"126", "controller"=>"users"} thanks for your help kad -- 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 -~----------~----~----~----~------~----~------~--~---
Jeff Cohen wrote:> On May 10, 8:54 am, Kad Kerforn <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: >> sure, I can state another action..... but is there any possibility to >> use only one action and perform differently according to a parameter... >> >> how can I pass parameters to the network action ? >> "http://localhost:3000/users/168.xml;network&plus=true" .... is it >> correctly RESTFUL?..... > > It''s ok to use the parameters to further "refine" your action, but > just make sure that your custom action shouldn''t really be a standard > action of another resource. It could very well be that although your > "network" action seems to be needed on a user resource, perhaps you''re > really stumbling upon a discovery of a new resource entirely. > > What does the network action try to do? And if you *had* to stick to > the seven RESTful actions, what action would "network" be and for what > resource? > > Those are the kinds of questions I ask myself whenever I feel like > adding a custom action, and about half the time, I''m able to just > declare a new resource and remove the custom action. > > Jeff > softiesonrails.comthe network action return an xml files where the ''friends'' of a user are described (friends_who_know_me and friends_i_know) one <Person>node for each friend and one <City> node for each friend.residence... it''s a complete description of a user''s network, which is built from user''s relationships so it''s a GET the network of a User.... I agree that it''s a resource but not in the DB.... it''s point I did not catch very well in RESTFul approach, it seems that all resources ARE ActiveResources... true or false ? kad -- 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 Thu, May 10, 2007 at 06:07:01PM +0200, Kad Kerforn wrote :> the network action return an xml files where the ''friends'' of a user are > described (friends_who_know_me and friends_i_know) one <Person>node > for each friend and one <City> node for each friend.residence... it''s a > complete description of a user''s network, which is built from user''s > relationships > so it''s a GET the network of a User....Why don''t you create a resource ''network'' which returns your formatted xml? You could also add routes like ''network/fred/paris'' (''network/:person/:location/'') to GET from this resource only the friends of fred located in Paris.> I agree that it''s a resource but not in the DB.... it''s point I did not > catch very well in RESTFul approach, it seems that all resources ARE > ActiveResources... true or false ?Resources are only a way to see some data on your network. It''s like models: it could be directly linked to real data in your database or not. For example, I use an ''auth'' resource for my login/logout actions which maps to cookies. login POST a cookie, is_logged_in? is a GET on a cookie etc. My $0.02, -- ,========================. | Pierre-Alexandre Meyer | | email : pam-1sEOgp2Wo8Qdnm+yROfE0A@public.gmane.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?hl=en -~----------~----~----~----~------~----~------~--~---
> could be, but...... > no route found to match "/users/168/network.xml" with {:method=>:get} > no route found to match "/users/168;network.xml" with {:method=>:get} > > only http://localhost:3000/users/168.xml;network is correctly > executed...The change was made in edge rails for Rails 2.0.> also how shoudl I write the URL in my rxml ?, I wrote > :dataURL => > "http://localhost:3000/users/#{friend.id}.xml;network?from=#{@user.id}&level=#{@level}"network_user_path(:id => friend, :from => @user, :level => @level) formatted_network_user_path(:id => friend, :from => @user, :level => @level, :format => :xml) -- Rick Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.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 -~----------~----~----~----~------~----~------~--~---