[Rails3] routing , how to constraint the id?

with a standard GET request defined as :

GET /remote_containers/:id/requestReady(.:format)
( :action=>“requestReady”, :controller=>“remote_containers” )

I can process such request :

GET /remote_containers/1/requestReady?requestId=999999

but is it possible to write a match and constraint ?

in order to accept :

GET /acme/requestReady?requestId=999999 => /remote_containers/10/
requestReady?requestId=999999

i.e.
/acme being rewritten as /remote_containers/10 ( the sender
doesn’t know the :id )

thanks for your feedback

match ‘acme/requestReady’ => ‘remote_containers#requestready’, :defaults
=> {:id => 10}

?

On May 22, 2011, at 11:32 , Erwin wrote:


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz

or
match ‘/:sender/requestReady’ => ‘remote_containers#requestready’, :via
=> :get

and process params[:sender] in your controller method

tom

On May 22, 2011, at 11:32 , Erwin wrote:


You received this message because you are subscribed to the Google G. “Ruby
on Rails: Talk” group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com www.maxwellrender.cz www.lightgems.cz

Thanks Tom

It seems the easiest way would be as per your feedback

reading in depth the doc ( and testing) I discover the power of
‘advanced constraints’ but sems to be a hammer for what I need to do…

thanks for your feedback

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs