# Active\_rbac doesn't understand before\_filter

**URL:** <https://www.ruby-forum.com/t/active-rbac-doesnt-understand-before-filter/88149>\
**Category:** Rails\
**Created:** [March 8, 2007, 3:12pm UTC](https://www.ruby-forum.com/t/active-rbac-doesnt-understand-before-filter/88149 "2007-03-08T15:12:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![milo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/85e7bf/32.png) [@milo](https://www.ruby-forum.com/u/milo)\
**Post date:** [March 8, 2007, 3:12pm UTC](https://www.ruby-forum.com/t/active-rbac-doesnt-understand-before-filter/88149/1 "2007-03-08T15:12:54Z")

</div>

I’ve moved an application onto the production server, and found that  
when I run it under the production environment active\_rbac doesn’t work  
(it’s fine under the development environment). I find this in the logs  
when trying to view a protected page:

NoMethodError (undefined method `before\_filter’ for  
ActiveRbac::ComponentController:Class):  
/app/controllers/active\_rbac/component\_controller.rb:2  
…lots more stuff…

The offending code is:

class ActiveRbac::ComponentController  
before\_filter :protect\_with\_active\_rbac

```
    protected

            def protect_with_active_rbac
                    # only protect certain controllers
                    return true if [ActiveRbac::LoginController,

```

ActiveRbac::RegistrationController,  
ActiveRbac::MyAccountController].include?(self.class)

```
                    # protect!
                    if !session[:rbac_user_id].nil? and

```

User.find\_by\_id(session[:rbac\_user\_id]).has\_role?(“Admin”)  
return true  
else  
flash[:notice] = “Please log in to  
access this page.”  
redirect\_to “/login”  
return false  
end  
end  
end

Can anyone suggest where I might begin to look for the cause of this  
error?
