def new
before_filter do
redirect_to \"/\" unless current_admin || current_company
flash[:notice] = \'You dont have enough permissions to be here
Create in your ApplicationController method:
def check_privileges!
redirect_to "/", notice: 'You dont have enough permissions to be here' unless current_admin || current_company
end
And then in your controller:
before_filter :check_privileges!, only: [:new, :create, :edit, :save]
Or
before_filter :check_privileges!, except: [:index, :show]