Skip to content

Instantly share code, notes, and snippets.

@cisolarix
Last active August 29, 2015 14:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cisolarix/c27ef105eee7e7500256 to your computer and use it in GitHub Desktop.
Save cisolarix/c27ef105eee7e7500256 to your computer and use it in GitHub Desktop.
获取 permission actions 列表
controllers = Dir.new("#{Rails.root}/app/controllers/admin").entries
controllers.each do |controller|
if controller =~ /_controller/
cont = controller.camelize.gsub(".rb","")
cont1 = controller.gsub("_controller.rb", "")
(eval("Admin::#{cont}.action_methods")).sort.each {|met|
puts "admin/#{cont1}##{met}"
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment