Topic: Routes

Hi

At the moment Im having a little trouble getting a route to work so I thought it could be good to start this thread (to help others) as well as help myself.

At present I have a controller 'licence_controller' and I want to be able to pass to the 'index' action an id.

so as an example of what im looking for is a url like

>> /licence_calculator_controller/image/5/index to be mapped to action => 'index'


Also would there be a more general way of specifying this so for example a url like

>> /licence_calculator_controller/{sending_controller}/{licence_id}/index
>> with {sending_controller} == the Controller that is sending the request to licence_calc

so that the index action would be able to find out the controller that sent the request as well as the id of the licence to be edited?

Re: Routes

Ok Ive been able to get both of these to work smile

I am now using

map.connect 'licence_calculator/:id/:sender',
:controller => 'licence_calculator'
:action => 'index'

Re: Routes

Glad to see you got it sorted out, and thanks for posting the solution; I'm sure someone else will find it useful in the future smile

vinnie - rails forum admin

Re: Routes

Its a pity that you can't edit the title.  Then ppl could put [solved] into the title

Re: Routes

alistair wrote:

Its a pity that you can't edit the title.  Then ppl could put [solved] into the title

All the more reason for us to respond to the challenge at the top of this page :-)