Mangled database record ids


#1

I’ve been going through the excellent tutorial in Agile Web
Development With Rails, and hit a bit of a snag. After doing the
‘pretty listings’ functionality for the Admin controller, attempting
to click ‘Show’ next to a product produces an error: ‘Couldn’t find
Product with ID=#Product:0x276180c

Further, the URL of the page that produces the error looks really
weird: ‘[…]/admin/show/%23%3CProduct%3A0x276180c%3E’ Navigating to
‘[…]/admin/show/1’ works fine.

It seems that either Rails or Ruby (or I) are mangling the database
record id values, but I’m not sure why, or how to fix the problem.

Any help greatly appreciated.

Thanks!

Mary


#2

I’ve been going through the excellent tutorial in Agile Web
Development With Rails, and hit a bit of a snag. After doing the
‘pretty listings’ functionality for the Admin controller, attempting
to click ‘Show’ next to a product produces an error: ‘Couldn’t find
Product with ID=#Product:0x276180c

It sounds like you’re using an older version of Rails that doesn’t
automatically pick the id out of models assigned to the :id field in
a route. What does gem search rails report?

-Ben


#3

Thanks for your help! After rather a lot of fiddling, I managed to
install the latest version of rails, and now the problem is solved.

Thanks again,

Mary