Search code examples
ruby-on-railsactivesupport

calling render raises "Undefined method 'logger' for true class"


I'm at a loss trying to figure out what is causing this issue. If I call any variation of render in my controller it raises the following:

NoMethodError: undefined method `logger' for true:TrueClass
from /Users/username/.rvm/gems/ruby-2.3.4/gems/activesupport-5.1.3/lib/active_support/configurable.rb:113:in `logger'

I checked active_support/configurable.rb:113 and I don't quite understand what it's comparing and raising for. I have other controllers that which both share the same base controller, that is not throwing this error when I render.

What am I not seeing here?

EDIT Calling render from

class Device::V1::DeviceController < ApplicationController

  def status
    render json: { foo: 'bar' }, status: :ok
  end
end

Below is my application controller

class ApplicationController < ActionController::API
  include ActionController::HttpAuthentication::Token::ControllerMethods
  before_action :authenticate!

  private

  def authenticate!
    authenticate_or_request_with_http_token do |token, options|
      token == SECRET[:api_key]
    end
  end
end

Rails 5.1.3

Ruby 2.3.4

UPDATE I had a method in this controller called config. Apparently this is a reserved namespace that conflicted with ActiveSupport


Solution

  • I had a controller method named config. This is a reserved name.