Forum: Ruby on Rails how to pass"page" parameter to xxx_path or xxx_url

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
A0bae8a464f7bdae361c4a07e4f84cd8?d=identicon&s=25 (Guest)
on 2007-03-26 14:22
(Received via mailing list)
Dear all,

In my app, i uses named route to point to a list page. This is a
paginated list. I try to go to a specific page by passing the "page"
parameter to the xxx_path method in link_to call, but this method
doesn't accept additional hash. So my question is is there a way to
construct a link to a specific page in pagination using xxx_path

- Chuong
83ca41657a99b65d99889abe712ba5e2?d=identicon&s=25 Jason Roelofs (Guest)
on 2007-03-26 15:07
(Received via mailing list)
Use xxx_url(params).

A2c85dc5ee81b12e3cc0a6522e8d079d?d=identicon&s=25 Chris Hall (au5lander)
on 2007-03-26 16:09
(Received via mailing list)
xxx_path(:id =>

xxx_url(:id =>
27c170f482104299af279902be0a9c26?d=identicon&s=25 Trevor Squires (Guest)
on 2007-03-26 19:05
(Received via mailing list)

the standard method is to pass a hash for everything instead of using
positional parameters:

foos_path(:parent_id => 'a_parent', :page => 2)

An alternative is to use my resource_fu plugin [1] which does allow
mixing of positional and hash parameters in your url helpers - though
that's not the *only* change to url helpers that it makes so you may
want to check out the README file to make sure its not introducing
behavior you'd rather not have.


[1] -
A0bae8a464f7bdae361c4a07e4f84cd8?d=identicon&s=25 Chuong Huynh (Guest)
on 2007-03-27 08:50
(Received via mailing list)

I've applied your suggestion, but instead of taking parameters which
match the named route description and only put the remained parameters
in the format of param1=value1&param2=value2..., it put all parameters
under that format.

Luckily in my case, the value of parameters in named route get
inherited from the current url so I just left out those parameters in
the xxx_path call, and it works now. However, I still want to know in
the case which these parameters not inherited, how can we pass all

Thank you for your help.

- Chuong
This topic is locked and can not be replied to.