Displaying 1 result from an estimated 1 matches for "username_regexp".
2010 Jul 27
0
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 prob...