Skip to content

Instantly share code, notes, and snippets.

@rmw
Last active December 11, 2015 03:48
Show Gist options
  • Select an option

  • Save rmw/4540215 to your computer and use it in GitHub Desktop.

Select an option

Save rmw/4540215 to your computer and use it in GitHub Desktop.
Railscast ActionController walkthrough * Get class and module inheritance in rails * Add middleware to controller http://railscasts.com/episodes/395-action-controller-walkthrough
class ArticlesController < ApplicationController
use Rack::ShowExceptions, only: :show
# ...
end
puts ArticlesController.ancestors
puts ArticlesController.ancestors - ArticlesController.included_methods # only inheritance chain
ArticlesController.action(:index) # rack endpoint (can call .call(env) on it)
ArticlesController.method(:action).source_location # where defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment