Skip to content

Instantly share code, notes, and snippets.

@jmbejar
Last active April 18, 2016 18:53
Show Gist options
  • Save jmbejar/0fdbfa4958385bc5241f9b3b102c5fa5 to your computer and use it in GitHub Desktop.
Save jmbejar/0fdbfa4958385bc5241f9b3b102c5fa5 to your computer and use it in GitHub Desktop.

Results of running self.class.ancestors in different types of controllers.

Please note the position of ActionView::Rendering with respect to the rendering modules that are present in all cases (ActionController::Renderers::All, ActionController::Renderers and ActionController::Rendering)

1- Controller inheriting from ActionController::Base

[
 ...
 ActionController::Renderers::All,
 ActionController::Renderers,
 ActionController::Rendering,
 ActionView::Layouts,
 ActionView::Rendering,
 ...
]

2- Controller inheriting from ActionController::API with jbuilder included (before fixing the issue)

[
 ...
 ActionView::Rendering,
 ...
 ActionController::Renderers::All,
 ActionController::Renderers,
 ActionController::Rendering,
 ActionController::ApiRendering,

 ...
]

3- Controller inheriting from ActionController::API with jbuilder included (fixed)

[
 ...
 ActionController::Renderers::All,
 ActionController::Renderers,
 ActionController::Rendering,
 ActionController::ApiRendering,
 ActionView::Rendering,
 ...
]

After the fix, the relative order of the rendering modules present on both type of controllers, AC::Base and AC::API, is preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment