Re: Renaming RESTful actions

Russell Norris
Sun, 18 Mar 2007 15:13:31 -0000

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