Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
namespace :filters do
desc 'List all filter permissions'
task :list => :environment do
controllers = Dir[Rails.root.to_s+'/app/controllers/**/*_controller.rb'].map{ |f| File.basename(f).gsub(/\.rb$/, '').classify }.sort
controllers.each do |controller|
filters = controller.constantize.filter_chain
puts controller
filters.each do |filter|
puts "\t#{filter.method}"
puts "\t\t" << filter.options.inspect unless filter.options.blank?
end
puts
end
end
end
ApplicationController
login_required
app_user_required
ClientsController
login_required
app_user_required
app_admin_required
{:only=>#<Set: {"edit", "update", "new", "create"}>}
super_admin_required
{:only=>#<Set: {"destroy"}>}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.