Forum: Ruby on Rails Puzzled with filters

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-04-14 13: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
  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
0a5d6fa912dda67f9b81017fbd9a81f2?d=identicon&s=25 Shane Sherman (Guest)
on 2006-04-14 18:55
(Received via mailing list)
xxxx is undefined, so that method is probably just returning nil?
06e1b396407b733b4b3d825cb2c57856?d=identicon&s=25 Leo -- (leopardus)
on 2006-04-14 20: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.