before_filter with dynamic information
- by Lauren
Hi
I am trying to add a filter to a controller that is based on a certain role (using role_requirement) and then on the company_id that each user has.
So basically I need something like this:
require_role "company" ** This is working fine
before_filter :company_required
def company_required
unless current_user.company_id == Company.find(params[:id])
end
end
The error I am receiving
undefined method `company_id' for nil:NilClass
I would appreciate any guidance. Thanks