Rails before_filter for specific actions in controller
Create in your ApplicationController
method:
def check_privileges! redirect_to "/", notice: 'You dont have enough permissions to be here' unless current_admin || current_companyend
And then in your controller:
before_filter :check_privileges!, only: [:new, :create, :edit, :save]
Or
before_filter :check_privileges!, except: [:index, :show]