I have a couple routes where I need to send additional parameters
every time *some* routes in my app are called.
In order to stay DRY, it makes sense to set these parameters in the
route, rather than passing them through for *every* url_for request.
Accordingly, I have defined a route as follows:
map.connect "sub_dir/my_friends/find",
:action=>"search",
:controller=>"friends",
:wrap_in_frame=>true,
:frame_height=>900
However, when I call url_for, it doesn''t match the route, even when it
is the *first* route in my routes.rb.
url_for( :action=>"search", :controller=>"friends" )
generates the
default route of "/friends/search", and NOT the route I''ve
specified
above.
If I remove the additional parameters (wrap_in_frame and frame_height)
from the route definition, than the url_for matches correctly.
Is it no longer possible to specify additional parameters when using
routes and url_for? The Agile Web Development book states that it is
possible to do this, but it doesn''t seem to work.
Note that I don''t want to use :defaults on the route, because I
don''t
ever want the routes to show up in the url. Additionally, I don''t want
to use named routes, because I have a lot of url_for statements, and
want to make sure that the additional parameters are set every time a
certain path is called, regardless of whether a developer remembers to
use the named route or not.
Am I doing something wrong, or is this functionality not supported?
Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---