Undefined method `singular_route_key' for "User":ActiveModel::Name

In ActionDispatch::PolymorphicRoutes, there is a call to
build_named_route_call an on line 172 (of latest rails code from
github), there is a call to singular_route_key:


Now model_name_from_record_or_class returns an ActiveModel::Name
object, which is a wrapper to the string class, that returns a string
name of the class of an activerecord model. I launch the console and
try to invoke singular_route_key, and it gives me undefined method:

1.9.2p290 :004 > @user.class.model_name.class
=> ActiveModel::Name
1.9.2p290 :005 > @user.class.model_name.singular_route_key
NoMethodError: undefined method `singular_route_key’ for

So what’s different here? How come it works in the live rails code but
not in the rails console? I asked a similar question on stackoverflow
and did not get a response, so I would really appreciate a response