Created
February 16, 2016 07:02
-
-
Save niltonvasques/649c7e39c928d4cdfa42 to your computer and use it in GitHub Desktop.
Generate roles for all controllers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| roles = Rails.application.routes.routes.map { |route| route.defaults[:controller] }.select { |i| not i.nil? }.uniq.select { |i| not i.match(/\//) }.reduce({}) { |h,i| h[i] = {index: true, new: false, create: false, edit: false, update: false, destroy: false }; h } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment