brighter.net

served with au jus sauce

print out a controller's expected actions

Posted by jacqui maher on April 26, 2008 at 04:59 PM

Ever want to see a list of actions defined on your controller and what methods over http they expect?

try this in your console, where “users” is your controller’s name:

   1  ActionController::Routing::Routes.routes.select do |route|
2 route.defaults[:controller] == "users"
3 end.uniq.each do |route|
4 puts "#{route.defaults[:action]} expects http method: #{route.conditions[:method]}"
5 end;nil

Tags: meta, ruby
Hierarchy: previous, next

Comments

There is 1 comment on this post. Post yours →

I try this method and it works well thanks for sharing nice tips with us.and can we check out previous action taken on user interface.

Post a comment

Required fields in bold.