Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Adding Regexp support for :only and :except options on filter_chains

#935

It would be nice to be able to pass in Regexp's to filter_chains. I attached the patch including units. First patch, so handle w/ care.

Example:

class MyController < ActionController::Base before_filter :auth, :only => Regexp.new(/.*_create/) end

Thanks

Reported by Ben VandenBos · August 29th, 2008 @ 06:58 PM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Ben VandenBos
    Ben VandenBos
    
    class MyController < ActionController::Base
      before_filter :auth, :only => Regexp.new(/.*_create/)
    end
    

    August 29th, 2008 @ 07:01 PM

  2. josh
    josh
    • State changed from new to wontfix

    Nice looking patch. However, you can already do this.

    
    class MyController < ActionController::Base
      before_filter :auth, :if => Proc.new { |controller|
          controller.action_name =~ /.*_create/
        }
    end
    

    Hopefully that solves your problem.

    August 29th, 2008 @ 08:47 PM

  3. Ben VandenBos
    Ben VandenBos

    Hahaha... of course.. guess I need to work on my googling..

    thanks!

    On Fri, Aug 29, 2008 at 12:47 PM, Lighthouse support@lighthouseapp.comwrote:

    August 29th, 2008 @ 09:10 PM