Using an ActiveRecord model in routes.rb

0 views
Skip to first unread message

Adam Stegman

unread,
Jul 27, 2010, 1:36:06 PM7/27/10
to Ruby on Rails: Talk
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.
Reply all
Reply to author
Forward
0 new messages