I think I found a bug with the to_json method in Rails.
I have generated a fresh scaffold and modified the create method to render the errors in JSON format.
The to_json method is removing the array from the returned hash.
Here is the result of a debug session.
(rdb:2) @recipe.errors {:name=>["can't be blank"]}
(rdb:2) @recipe.errors.to_json "{\"name\":\"can't be blank\"}"
As you can see, the array has been removed.
Has anyone else found this?
Cheers,
Tim
{:name=>["can't be blank"]}.to_jsondo in the Rails console?