Looking at your route, you might be crossing two different things. What are you paginating? If it's profiles, there's no need to supply an id. Let's assume you're trying to paginate profiles. Your route would look like this:
map.connect '/profiles/browse/:page',
:controller => 'profiles',
:action => 'index',
:page => /\d+/
And your controller action would look like this:
def index
@profiles = Profile.paginate :page => params[:page]
end
If you are trying to nest something within profiles, say browsing a profile's pictures, you'll need to do it more like this:
map.connect '/profiles/:id/browse/:page',
:controller => 'profiles',
:action => 'index',
:id => /\d+/,
:page => /\d+/
with your controller like so:
def index
@profile = Profile.find(params[:id])
@pictures = @profile.pictures.paginate :page => params[:page]
end
Let me know if this works.
UPDATE:
You listed in the comments that /profile/1/
is referring to the user's own profile. First, this is dangerous because you don't want people to change what profile the app thinks they are, just by changing that id number by hand. Rely on whatever current_user
method your authentication gives you.
However, using your current setup as the example, this is what it would look like:
map.connect '/profiles/:id/browse/:page',
:controller => 'profiles',
:action => 'browse',
:id => /\d+/,
:page => /\d+/
with your controller like so:
def browse
@profile = Profile.find(params[:id])
@profiles = Profile.paginate :page => params[:page]
end
Let me know if you still have questions.
UPDATE 2
In order to get a nice link_to
with this, change the route to a named route:
map.profile_browse '/profiles/:id/browse/:page',
:controller => 'profiles',
:action => 'browse',
:id => /\d+/,
:page => /\d+/
Now you can call link_to
like so:
link_to profile_browse_path(:id => 1, :page => 10)