#342 √ resolved
Paul Carey

'only' filter option leaks into other controllers

Reported by Paul Carey | May 23rd, 2008 @ 11:23 AM | in 0.9.4

Maybe this is expected, but the following was certainly a surprise for me. Given the code below, hitting /c2 does not result in "foo" being printed. If the only option is removed from the before filter in c1.rb, accessing /c2 does then result in "foo" being printed.

File: /app/controllers/application.rb
class Application < Merb::Controller
  before :print_foo
end

File: /app/controllers/c1.rb
class C1 < Application
  before :print_foo, :only => :meh
  def index; render; end
  def meh; "meh"; end
end

File: /app/controllers/c2.rb
class C2 < Application
  def index; render; end
end

File: /app/helpers/global_helpers.rb
module Merb
  module GlobalHelpers
    def print_foo; Merb.logger.info("foo"); end
  end
end

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins