Skip to content
Menu
Justin Ball
  • About
  • Privacy Policy
Justin Ball

Category: to_json

to_json gives TypeError Exception: wrong argument type Hash (expected Data)

Posted on August 17, 2009October 25, 2021

Tonight for no apparent reason my tests started turning up this error whenever I tried to call to_json: TypeError Exception: wrong argument type Hash (expected Data) </pre> Specifically, my to_json call looked like this: respond_to do |format| format.js { render :json => @states.to_json(:only => [:id, :name]) } end </pre> In the debugger .to_json worked but…

©2025 Justin Ball | Powered by SuperbThemes & WordPress