1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Make ApplicationController inherit from AC::API for API plugins

This commit is contained in:
Robin Dupret 2015-07-23 17:58:02 +02:00
parent 67863aa844
commit e3cfd5b174
2 changed files with 9 additions and 1 deletions

View file

@ -1,5 +1,5 @@
<%= wrap_in_modules <<-rb.strip_heredoc
class ApplicationController < ActionController::Base
class ApplicationController < ActionController::#{api? ? "API" : "Base"}
end
rb
%>

View file

@ -556,6 +556,14 @@ class PluginGeneratorTest < Rails::Generators::TestCase
end
end
def test_application_controller_parent_for_mountable_api_plugins
run_generator [destination_root, '--mountable', '--api']
assert_file "app/controllers/bukkits/application_controller.rb" do |content|
assert_match "ApplicationController < ActionController::API", content
end
end
protected
def action(*args, &block)
silence(:stdout){ generator.send(*args, &block) }