opened
richardvenneman
username_0
Hi,

I'm trying to use `rails_admin` with a Rails 5 API project and I'm not sure wether to post this issue on the `rails_api` project or here..

In Rails 5 API the ActionController is somewhat slimmed down but it's easy to [configure additional modules](https://github.com/rails-api/rails-api#choosing-controller-modules).

I configured my application to use `ActionDispatch::Flash`:

```ruby
module MyApp
  class Application < Rails::Application
    ...
    config.middleware.use ActionDispatch::Flash
  end
end
```

I configured the API ActionController to include the following modules:

```ruby
class ApplicationController < ActionController::API
  ...
  include AbstractController::Helpers
  include ActionController::Flash
  include ActionController::RequestForgeryProtection
  include ActionController::MimeResponds
  include ActionController::HttpAuthentication::Basic::ControllerMethods
  include ActionView::Layouts
end
```

With these changes the Rails Admin dashboard seems to run fine. However, when I'm trying to access the JSON resources in my application, the following error is thrown:

```
Error:
BookingsControllerTest#test_should_get_index:
ActionView::MissingTemplate: Missing template bookings/index, application/index with {:locale=>[:en], :formats=>[:json], :variants=>[], :handlers=>[:raw, :erb, :html, :builder, :ruby, :haml]}. Searched in:
  * "/Users/richard/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/rails_admin-355dc80f8a20/app/views"
```

This is the controller code:

```
class BookingsController < ApplicationController
  def index
    @bookings = find_bookings
    render json: @bookings, include: ['customer', 'client'], meta: meta
  end
end
```

This only happens after I include the `ActionView::Layouts` module in the top level ActionController::API class to support Rails Admin.

Have been trying things for a couple of hours now.. does anyone have a suggestion?
Usage with rails_api (ActionView::MissingTemplate thrown after including ActionView::Layouts)
issue
created
slbug
username_1
I decided to add another controller 

```ruby
class AdminController < ActionController::Base
  ...
end
```

and for devise and rails_admin added ```config.parent_controller = '::AdminController'``` in theirs initializers
comment
created
richardvenneman
username_0
@username_1 That seemed to be the solution, yes. More details: http://stackoverflow.com/questions/36840247/using-rails-admin-with-rails-api
comment
closed
richardvenneman
username_0
issue