I''ve got a RESTful controller that takes in a file upload as the main input into a table. I want to rename POST:resources_url to hit #upload instead of #create. Is there something I can specify on map.resources that allows me to do this? Or am I stuck generating a URL like "/resource/;upload" ? Jason --~--~---------~--~----~------------~-------~--~----~ 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 3/16/07, Jason Roelofs <jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''ve got a RESTful controller that takes in a file upload as the main > input into a table. I want to rename POST:resources_url to hit #upload > instead of #create. Is there something I can specify on map.resources that > allows me to do this? Or am I stuck generating a URL like > "/resource/;upload" ? > > Jason >A little more information, here''s my test (which is failing, difference being :action => ''create'' is generated, not ''upload''): assert_recognizes({:controller => ''taxes'', :action => ''upload''}, {:path => ''taxes'', :method => :post}) and current routing map.resources :taxes, :new => {:upload => :post} Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, 2007/3/16, Jason Roelofs <jameskilton@gmail.com>:> A little more information, here's my test (which is failing, difference > being :action => 'create' is generated, not 'upload'): > > assert_recognizes({:controller => 'taxes', :action => 'upload'}, {:path > => 'taxes', :method => :post}) > > and current routing > > map.resources :taxes, :new => {:upload => :post}map.connect "/taxes/upload", :controller => "taxes", :action => "upload" Everything that existed before resources still exists now that resources are here. That's one of the nice thing. We get to make our cake and eat it too :) Bye ! -- François Beausoleil http://blog.teksol.info/ http://piston.rubyforge.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@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---
On 3/16/07, François Beausoleil <francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > 2007/3/16, Jason Roelofs <jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > A little more information, here''s my test (which is failing, difference > > being :action => ''create'' is generated, not ''upload''): > > > > assert_recognizes({:controller => ''taxes'', :action => ''upload''}, > {:path > > => ''taxes'', :method => :post}) > > > > and current routing > > > > map.resources :taxes, :new => {:upload => :post} > > map.connect "/taxes/upload", :controller => "taxes", :action => "upload" > > Everything that existed before resources still exists now that > resources are here. That''s one of the nice thing. We get to make our > cake and eat it too :) > > Bye ! > -- > François Beausoleil > http://blog.teksol.info/ > http://piston.rubyforge.org/I know that the old routing is still available, I''m trying to stay away from it as much as I can. The problem I have with REST right now is that there is no "accepted spec" for doing REST, if that makes any sense. When it comes to controllers that are a little more complex than just serving up a view to a model, is it ok to drop out of REST? What is the point that a site is no-longer RESTful? Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
2007/3/16, Jason Roelofs <jameskilton@gmail.com>:> I know that the old routing is still available, I'm trying to stay away from > it as much as I can. The problem I have with REST right now is that there is > no "accepted spec" for doing REST, if that makes any sense. When it comes to > controllers that are a little more complex than just serving up a view to a > model, is it ok to drop out of REST? What is the point that a site is > no-longer RESTful?You have to be pragmatic. If the REST philosophy doesn't fit a particular case, well, don't bother. Hope that helps ! -- François Beausoleil http://blog.teksol.info/ http://piston.rubyforge.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@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---
On 3/16/07, François Beausoleil <francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 2007/3/16, Jason Roelofs <jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > I know that the old routing is still available, I''m trying to stay away > from > > it as much as I can. The problem I have with REST right now is that > there is > > no "accepted spec" for doing REST, if that makes any sense. When it > comes to > > controllers that are a little more complex than just serving up a view > to a > > model, is it ok to drop out of REST? What is the point that a site is > > no-longer RESTful? > > You have to be pragmatic. If the REST philosophy doesn''t fit a > particular case, well, don''t bother. > > Hope that helps ! > -- > François Beausoleil > http://blog.teksol.info/ > http://piston.rubyforge.org/It *does* fit. All I''m trying to do is rename the action being used by the POST action (default create, I want to rename it to upload). Is this possible? Jason --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Jason,
Earlier on you said: Or am I stuck generating a URL like "/
resource/;upload"
Forgive me if I''m being dense, but *why* do you want he default POST
to call a method called update() rather than create()? It seems to
me that if you want POST /some/url to perform a specific set of
actions, why wouldn''t you just do those actions in *create* rather
than fight the framework?
Or, are you in fact saying that you want to have *two* urls to create
a resource in your :taxes resource collection: one that calls create
() and another that calls upload()?
If so, have you tried:
map.resources :taxes, :collection => {:upload => :post}
However, that most definitely *does* generate a resource url like /
taxes;upload so it may not be what you''re looking for.
Regards,
Trevor
On 16-Mar-07, at 1:11 PM, Jason Roelofs wrote:
> On 3/16/07, François Beausoleil
<francois.beausoleil-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> 2007/3/16, Jason Roelofs
<jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> > I know that the old routing is still available, I''m trying to
> stay away from
> > it as much as I can. The problem I have with REST right now is
> that there is
> > no "accepted spec" for doing REST, if that makes any sense.
When
> it comes to
> > controllers that are a little more complex than just serving up a
> view to a
> > model, is it ok to drop out of REST? What is the point that a
> site is
> > no-longer RESTful?
>
> You have to be pragmatic. If the REST philosophy doesn''t fit a
> particular case, well, don''t bother.
>
> Hope that helps !
> --
> François Beausoleil
> http://blog.teksol.info/
> http://piston.rubyforge.org/
>
> It *does* fit. All I''m trying to do is rename the action being
used
> by the POST action (default create, I want to rename it to upload).
> Is this possible?
>
> Jason
>
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
One thing I had to let go of when I started using the RESTful methodology was the need to have my urls all styled looking with no parameters hanging out looking all ugly. Sometimes getting those params inline is a matter of rethinking things and nesting routes but sometimes you just have to raise up those hands and concede to the RESTy way. I'm still bugged by things like http://domain.com/users/1/entries;?page=2 but I've come to accept them [on my admin side*] as accurate representations of what is important and what is ephemeral/peripheral information. In this case, the fact that the data on page two isn't necessarily the same every time is a good indicator that it's not actually a resource itself and therefore just a hanging param. Perhaps your desire to rename "create" to "upload" without having to change its basic function is similar. :) RSL *On my spiderable content side, I've heard that urls like http://domain.com/users/1/entries;?page=2 don't get indexed and therefore aren't perhaps the best way of arranging one's archives. YMMV On 3/16/07, Trevor Squires <trevor@protocool.com> wrote:> > Hi Jason, > > Earlier on you said: Or am I stuck generating a URL like > "/resource/;upload" > > Forgive me if I'm being dense, but *why* do you want he default POST to > call a method called update() rather than create()? It seems to me that if > you want POST /some/url to perform a specific set of actions, why wouldn't > you just do those actions in *create* rather than fight the framework? > Or, are you in fact saying that you want to have *two* urls to create a > resource in your :taxes resource collection: one that calls create() and > another that calls upload()? > > If so, have you tried: > > map.resources :taxes, :collection => {:upload => :post} > > However, that most definitely *does* generate a resource url like > /taxes;upload so it may not be what you're looking for. > > Regards, > Trevor > > On 16-Mar-07, at 1:11 PM, Jason Roelofs wrote: > > On 3/16/07, François Beausoleil <francois.beausoleil@gmail.com> wrote: > > > > 2007/3/16, Jason Roelofs <jameskilton@gmail.com>: > > > I know that the old routing is still available, I'm trying to stay > > away from > > > it as much as I can. The problem I have with REST right now is that > > there is > > > no "accepted spec" for doing REST, if that makes any sense. When it > > comes to > > > controllers that are a little more complex than just serving up a view > > to a > > > model, is it ok to drop out of REST? What is the point that a site is > > > no-longer RESTful? > > > > You have to be pragmatic. If the REST philosophy doesn't fit a > > particular case, well, don't bother. > > > > Hope that helps ! > > -- > > François Beausoleil > > http://blog.teksol.info/ > > http://piston.rubyforge.org/ > > > It *does* fit. All I'm trying to do is rename the action being used by the > POST action (default create, I want to rename it to upload). Is this > possible? > > Jason > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---