3

Whenever a controller renders json I get, uninitialized constant Mime::JSON I have not modified any code related to this.

Ex, the code for this controller method that throws the error:

def names @families = Family.pluck(:name) render json: @families end

This was working fine before the rails 5 upgrade.

Chris Habgood
  • 400
  • 3
  • 11
  • I think the issue is using the responders gem. I had to use the normal respond_to do |format|, syntx in order for it to render correctly. – Chris Habgood Mar 26 '18 at 20:51

2 Answers2

3

In my case, it was jbuilder causing this error.

Upgrading jbuilder to latest (2.7.0 at time of writing) solved this. The old jbuilder references JSON wrong and causes responder to fail.

berkes
  • 26,996
  • 27
  • 115
  • 206
2

I was obtaining the error after upgrade from rails 5.0.1 to 5.1.0 and in my case the gem 'web-console','~> 2.0' was causing the error, I solved it updating it to gem 'web-console','>= 3.3.0'.

FonchoRG
  • 81
  • 1
  • 5