Problem generating url helper

i have a problem with generating a url with the helper.

in the routes.rb:

cats

map.cat ‘/category/:id/:page’, :namespace => ‘front’, :controller =>
‘cats’, :action => ‘cat’, :requirements => { :page => /\d+/ }, :page =>
nil
map.cat ‘/category/:id’, :namespace => ‘front’, :controller => ‘cats’,
:action => ‘cat’

when the url is generating from will_paginate plugin helper it work
fine.
but if i want to set my personal helper to build the url with the page,
example:

<%= cat_url( @obj.id, var_numb_page ) =>
where “var_numb_page” is a integer indicates the :page param

i have this error:

undefined method `has_key?’ for 2:Fixnum

i not understand where is the problem.

On Feb 25, 2010, at 9:29 AM, Aldo I. wrote:

map.cat ‘/category/:id’, :namespace => ‘front’, :controller => ‘cats’,
:action => ‘cat’

Why do you have two routes named the same thing (“cat”)? Get rid of
the second one since you’re allowing page to be nil in the first.

I think the error your getting is because cat_url is trying to match
against “/category/:id” which only has a single argument and you’re
supplying two and it’s complaining about that.

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