Skip to content

Instantly share code, notes, and snippets.

@arjan0307
Last active December 13, 2015 19:08
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 arjan0307/4960215 to your computer and use it in GitHub Desktop.
Save arjan0307/4960215 to your computer and use it in GitHub Desktop.
Controller extension
<% if namespaced? -%>
require_dependency "<%= namespaced_path %>/application_controller"
<% end -%>
<% module_namespacing do -%>
class <%= class_name %>Controller < CustomController
<% actions.each do |action| -%>
def <%= action %>
end
<%= "\n" unless action == actions.last -%>
<% end -%>
end
<% end -%>
require 'rails/generators/rails/controller/controller_generator'
class CustomControllerGenerator < Rails::Generators::ControllerGenerator
source_root File.expand_path('../templates', __FILE__)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment