I have an error with before_filter

I have this for my before_filters in a controller

  before_filter :authorize_company_or_admin, :except => [ :index, :list, :show, :display_meetings ]   before_filter :authorize_admin, :only => [ :index, :list, :show ]

the :authorize_company_or_admin isn't working. If I do the action show_meeting, it lets the user right through. However, if I change it to   before_filter :authorize_company_or_admin, :only => [ :show_meeting ]

Then it stops the user. The logic in the action is definitely legit, so it's not that.

The other problem I have, is that :authorize_company_or_admin does a redirect if the user is not allowed to access something. However, all of my actions in the other controllers render partials. So if a user isn't authorized to access something, both the redirect and render partial get called, and I get the "Render and/or redirect were called multiple times" error. How can this be avoided?

Thanks in advance!!! Ben Lisbakken

Ben Lisbakken пишет:

The other problem I have, is that :authorize_company_or_admin does a redirect if the user is not allowed to access something. However, all of my actions in the other controllers render partials. So if a user isn't authorized to access something, both the redirect and render partial get called, and I get the "Render and/or redirect were called multiple times" error. How can this be avoided?   

Haven't you forgot to return false from authorize_company_or_admin when it forbids access ?

Maxim - Thanks, you were completely right. However, I still have the problem where :except doesn't work! I have to do :only and name all of the actions I want it to work on :frowning:

-Ben