This project is archived and is in readonly mode.

#4491 ✓resolved
Samuel Lebeau

Avoid potentially expensive inspect call in router

Reported by Samuel Lebeau | April 27th, 2010 @ 10:24 PM

The attached patch defers the creation of a routing error message in ActionDispatch::Routing::RouteSet::Generator#generate which invoke inspect on the argument of url_for (or any routing helper method actually).

This call might be expensive, especially when the argument happens to be a database record with blob fields, and is currently executed even if the route is valid.

For example, when using SlimScrooge with the following view:

<%= link_to, foo %>
SELECTed fields are expected to be id and name, but happen to be all fields from the table.

The patch applies on HEAD and fixes the above-mentioned issue, all tests are passing.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>


Referenced by