diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dc7ccf1ac..f7eb5a78a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,9 @@ [Full Changelog](https://github.com/sferik/rails_admin/compare/v1.0.0.rc...HEAD) +### Changed +- Change parent controller to ActionController::Base for out-of-box support of Rails 5 API mode([#2688](https://github.com/sferik/rails_admin/issues/2688)) + - To keep old behavior, add `config.parent_controller = '::ApplicationController'` in your RailsAdmin initializer. ## [1.0.0.rc](https://github.com/sferik/rails_admin/tree/v1.0.0.rc) - 2016-07-18 diff --git a/lib/rails_admin/config.rb b/lib/rails_admin/config.rb index 37676b72dc..1f79688646 100644 --- a/lib/rails_admin/config.rb +++ b/lib/rails_admin/config.rb @@ -283,7 +283,7 @@ def reset @show_gravatar = true @navigation_static_links = {} @navigation_static_label = nil - @parent_controller = '::ApplicationController' + @parent_controller = '::ActionController::Base' RailsAdmin::Config::Actions.reset end diff --git a/lib/rails_admin/engine.rb b/lib/rails_admin/engine.rb index 245cb4bff5..588e62faff 100644 --- a/lib/rails_admin/engine.rb +++ b/lib/rails_admin/engine.rb @@ -23,7 +23,8 @@ class Engine < Rails::Engine ) end - initializer 'RailsAdmin pjax hook' do |app| + initializer 'RailsAdmin setup middlewares' do |app| + app.config.middleware.use ActionDispatch::Flash app.config.middleware.use Rack::Pjax end