Puzzled with filters


#1

Hello everyone!

I’m trying to create an after filter for all my actions in all
controllers. I put it in application controller (application.rb).

class ApplicationController < ActionController::Base
after_filter :tidyit

def tidyit
xxxx # syntax error - intentionally
end
end

I have a Example (example_controller.rb) controller with index action.

class ExampleController < ActionController::Base
def index
@result = “Hello, world!”
end
end

When I try to access server:3000/example/index I see my hello world
string. But it should be compile error (see “xxxx” in filter code). No
matter what I do inside the filter, this filter is not applied at all!

I’m very puzzled.

I do restart webrick after modifications to the controllers.

ruby 1.8.4 (2005-12-24) [i686-linux]
rails 1.0.0


olegf


#2

xxxx is undefined, so that method is probably just returning nil?


#3

No, this xxxx was just my last try. I can place anything in this
method, and it is still ignored. Very strange :expressionless: