Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

before_filter: is it possible to specify controller for action?

I'm having the following string in my application_controller:

  before_filter :login_required, :only => [ :edit, :update, :show, :index ] 

But in case with :show, I need to put {:controller => 'users', :action => 'show'} in exception. Is it possible to do that?

like image 856
Arty Avatar asked Sep 08 '10 04:09

Arty


1 Answers

Options:

  • Use a skip_before_filter in the UsersController

    skip_before_filter :login_required, :only => :show

  • Applying the before_filter individually to each controller, if your exceptional cases grow.

like image 57
Chubas Avatar answered Nov 01 '22 01:11

Chubas