Forum: Ruby on Rails Puzzled with filters

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Leo -. (Guest)
on 2006-04-14 15:11
(Received via mailing list)
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

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

class ExampleController < ActionController::Base
  def index
    @result = "Hello, world!"

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

Shane S. (Guest)
on 2006-04-14 20:55
(Received via mailing list)
xxxx is undefined, so that method is probably just returning nil?
Leo -. (Guest)
on 2006-04-14 22:55
(Received via mailing list)
No, this xxxx was just my last try. I can place anything in this
method, and it is still ignored. Very strange :|
This topic is locked and can not be replied to.