Skip to content

Instantly share code, notes, and snippets.

@vrinek
Created May 5, 2011 22:34
Show Gist options
  • Save vrinek/958115 to your computer and use it in GitHub Desktop.
Save vrinek/958115 to your computer and use it in GitHub Desktop.
def all_controller_actions(controller)
(controller.ancestors[1, controller.ancestors.index(ApplicationController)] + [Object]).inject(controller.new.methods) do |methods, ancestor|
methods -= ancestor.new.methods unless ancestor.class == Module
methods
end.reject{|m| m =~ /^_/}.sort.map(&:to_sym)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment