Yes, it before_filteris a method on ActionController :: Base. Everything that is specified in before_filterwill be executed before the action (s) are called.
API documentation: http://api.rubyonrails.org/classes/ActionController/Filters/ClassMethods.html#M000316
EDIT:
When you write directly to a class, this code is executed when the class is loaded into the interpreter.
Putting this into the IRB:
>> class Hello
>> p "hello"
>> end
"hello"
, , before_filter, . , , Object. ActionController:: Base before_filter, , .
>> ActionController::Base.class
=> Class
>> ActionController::Base.class.superclass
=> Module
>> ActionController::Base.class.superclass.superclass
=> Object
>> ActionController::Base.class.superclass.superclass.superclass
, MetaProgramming Ruby, , .