Skip to content

tcopeland/filter_decrufter

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

FilterDecrufter

FilterDecrufter is a little utility for cleaning up before_filters.

Suppose you have a Rails controller with a before_filter:

before_filter :load_widget, :only => [:show, :frobnicate]

If you've deleted the frobnicate action, Rails won't complain. But FilterDecrufter will!

Usage

Add it to your Gemfile in the development group:

# In your Gemfile
gem 'filter_decrufter'

Run the task!

$ bundle exec rake filter_decrufter:check 
Api::V1::WidgetsController before_filter 'find_widget' has an :only constraint with a non-existent action name 'show'
EmployeesController after_filter 'set_name' has an :only constraint with a non-existent action name 'frobnicate'

Tested with Rails 3.2, 4.0, 4.1 and 4.2.

Credits

About

Decruft those Rails filters

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages