non-CRUD actions with REST

Hi all,

About non-CRUD actions, how they are handled with RESTful application.
I mean that if i needed to use link_to to that kind of actions, how
it’s
done.

thanks,
Sorry for disturbance,
Mostafa Badawi

This answers most questions about routing and I don’t know why more
people don’t link to it!

Greetings Mostafa,

If you are creating custom actions, there are many ways to route to
them. One of those ways is named routes. If you take a look in the
config/routes.rb file, you should find a lot of example routes you can
setup. Everything is processed from top to bottom. Thus, your should
have your most specific routes near the top and your most general
routes near the bottom.

Here is an example:

map.purchase ‘products/:id/purchase’, :controller =>
‘catalog’, :action => ‘purchase’
www.example.com/products/3/purchase would be routed to the catalog
controller, using the purchase action

To understand what routes are available to you, run the rake command:
rake routes. Reading this list, take the name of the route and add
either a _path, or _url, and the correct path or URL will be created.
You can experiment with this by printing your path / URL to the screen
in an erb file. For example:

<%= example_route_path %> would output something like /example/

Hope that helps some. Search the group for REST and I’m sure you’ll
come up with loads of helpful information. :o)

~Dustin T.

Next time… I’ll link. :o) Very helpful article, and funny too!
That’s a lot better than my short explanation.

~Dustin T.