search for: validate_us

Displaying 2 results from an estimated 2 matches for "validate_us".

Did you mean: validate_ns
2006 May 08
3
Can you have multiple before filters?
Hi, Is it possible to specify multiple before filters in a controller... here''s the thing: only one set of filters is to use the :except option. Something like: before_filter :check_for_session_cookie before_filter :validate_user :except =>[''login''] which I use to a) check if the user has returned to the site and has a saved cookie holding login details b) check to see if user is logged on, unless they are attempting to do so. As far as I can tell the :except is applied to both my before filters....
2006 Feb 08
2
Protecting controllers - looking for a DRY solution
...a bunch of controllers for each user role. I''m trying to set up some sort of validation that the user accessing e.g. the admin/subjects controller has the ''admin'' role. The brute force way to do this would be something like: - for each controller, put in before_filter :validate_user def validate_user if session[:user].role != ''admin'' flash[:notice] = "You don''t have permission to access this" redirect_to :controller => session[:user].role, :action => ''home'' end end However, I don''t want to put...