Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #5320 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Route generation crashes when "requirements" are specified.

Reported by: valdand@soften.ktu.lt Assigned to: David
Priority: normal Milestone:
Component: ActionPack Version: 1.1.1
Severity: critical Keywords:
Cc:

Description

Having requirements in routing.rb as:

map.connect ':controller/:action/:id',

:requirements => { :id => /\d+/ }

and code

article = Article.find(:first)

<%= link_to :action => "edit", :id => article %>

gives error: can't convert Fixnum into String

However if you use :id => article.id it works.

article.to_param

=> 1

article.id.to_param

=> "1"

Maybe related to Changeset [4437]

Attachments

rails_bug.txt (1.3 kB) - added by valdand@soften.ktu.lt on 06/10/06 09:31:28.
trace file

Change History

06/09/06 23:00:59 changed by jrm02t@gmail.com

Trace would be helpful.

06/10/06 09:31:28 changed by valdand@soften.ktu.lt

  • attachment rails_bug.txt added.

trace file

06/13/06 17:52:52 changed by anonymous

  • severity changed from normal to critical.

increasing severity since complex routes are downright broken right now.

I am getting the same error calling the following route:

route.wishlist 'wishlist/:id',

:action => 'show_wishlist', :requirements => {:id => /\d*/}

06/19/06 16:30:14 changed by rubyonrails@beautifulpixel.com

  • version set to 1.1.1.
  • summary changed from link_to does not work with new routing code with routing requiremens set to Route generation crashes when "requirements" are specified..

06/19/06 16:45:35 changed by ulysses

  • status changed from new to closed.
  • resolution set to fixed.

(In [4459]) Change AR::Base#to_param to return a String instead of a Fixnum. Closes #5320.