-
Notifications
You must be signed in to change notification settings - Fork 381
Closed
Description
My API controller methods try to render JSON responses using jbuilder:
def companies
render template: 'api/v1/users/companies',
format: :json,
locals: { companies: current_user.companies }
end
However, all responses are now empty.
As a fix, I removed the call to ActionController::Base.send :include
and ActionController::API.send :include
in https://github.com/ankane/ahoy/blob/master/lib/ahoy.rb#L119 and include the modules now manually:
class ApplicationController < ActionController::Base
protect_from_forgery
include Ahoy::Controller
class Api::ApiController < ActionController::API
include Ahoy::Controller
I personally prefer this a lot, as it removes the magic and activates Ahoy explicitly.
Also see this PR for a similar discussion: rails/strong_parameters#144
coryschires
Metadata
Metadata
Assignees
Labels
No labels