3 ms·
Use lambdas for Rails 3 Route Constraints
- loginx 16y agoThat's pretty neat, but doesn't it make more sense to use before_filter in your controller for that stuff so that you can properly handle errors instead of showing a 404?
- siong1987 16y agoI don't think that the op will want to show a 404 page. If a user is logged in, I will redirect the user to the homepage. Why let the user accesses the login page if the user has already logged in? I guess that is what the op trying to do.
- joe_the_user 16y agoSo they can log in as a different user? So they can use the back arrow and go to the page they at before login redirected them? I found Drupal's hiding of the login page once I was logged to be truly annoying on a site I regularly visited (till it was apparently changed recently).
- steveklabnik 16y agoYou're assuming all requests actually go through to the rails app: what if you have, say, a Sinatra app mounted at '/documentation' and you'd like to check the constraints for that?