Reputation: 5144
Got this error while installing active admin on rails 4.0.2 application. I am using rails-api, where I need something like this admin to manage content apart from client.
undefined method `layout' for ActiveAdmin::Devise::SessionsController:Class
I am not sure about this error.
Upvotes: 0
Views: 1581
Reputation: 6135
When use rails-api(it's merged into rails 5 now), your ApplicationController
will inherits from ActionController::API
instead of ActionController::Base
, while rails admin dependents on ActionController::Base
and some other middlewares. To make active admin works with rails api mode, your need to do some additional work:
Make your ApplicationController
inherit from ActionController::Base
class ApplicationController < ActionController::Base
Modify your config/application.rb
like this
class Application < Rails::Application
# ...
config.middleware.use ActionDispatch::Flash
config.middleware.use Rack::MethodOverride
config.middleware.use ActionDispatch::Cookies
end
References:
1. https://rrott.com/blog/ror/rails-5-api-with-activeadmin-integration.html
2. What is the difference between a regular Rails app and a Rails API?
Upvotes: 1
Reputation: 73
It is now ActionView::Layouts
See https://github.com/rails/rails/issues/14517
Upvotes: 2
Reputation: 5144
Okay looks like it has been solved by adding this on application controller.
include AbstractController::Layouts
Upvotes: 2