Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

before_filter running multiple methods

is it possible to have:

before_filter :authenticate_user! || :authenticate_admin!

like image 625
stewart715 Avatar asked May 02 '11 02:05

stewart715


Video Answer


2 Answers

before_filter :do_authentication

def do_authentication
  authenticate_user! || authenticate_admin!
end
like image 174
gunn Avatar answered Sep 22 '22 00:09

gunn


before_filter {authenticate_user! || authenticate_admin!}

Passing in a proc to the before_filter method, would be the closest to what you have provided in you question.

like image 23
thekindofme Avatar answered Sep 21 '22 00:09

thekindofme