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 to_json(:only => [:id, :name]) did not. Needless to say given that since I hadn't touch this code in a while I was not happy and spent some time describing my code with colorful metaphors. Nothing makes me crazy like code that magically stops working. Turns out I had installed shvets-google_translate that depended on json_pure. json_pure doesn't seem to play nice with activesupport. For some that works. For me it did not. Apparently, Active Support and JSON gems don't play nice. No more colorful metaphors (for now). UPDATE Ruby on Rails 2.3.3 fixes this problem with as_json. Thanks guys!