This project is archived and is in readonly mode.

#935 ✓wontfix
Ben VandenBos

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

Reported by Ben VandenBos | August 29th, 2008 @ 06:58 PM | in 2.x

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

Comments and changes to this ticket

  • Ben VandenBos

    Ben VandenBos August 29th, 2008 @ 07:01 PM

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

    josh August 29th, 2008 @ 08:47 PM

    • 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.

  • Ben VandenBos

    Ben VandenBos August 29th, 2008 @ 09:10 PM

    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:

Create your profile

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

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Attachments

Pages