Using an ActiveRecord model in routes.rb

Is it potentially dangerous to use an ActiveRecord model in routes.rb?

Here’s a line from our routes.rb file:

map.resources :registrations, :requirements => { :id => User::USERNAME_REGEXP }
Registration#to_param returns the User’s username.
User::USERNAME_REGEXP is just a regex that matches one or more valid
username characters.

This route works as expected, but my concern is that using an
ActiveRecord model in the routes file is loading it prematurely and
could cause problems somehow.

This is all in Rails 2.3.8, REE 1.8.7 2010.02.

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