This project is archived and is in readonly mode.
Rails 2.1.2 from_json broken?
-
Frederick Cheung
You have to pass a json string that corresponds to a hash - what would blah.from_json('asdf') even mean?
Blah.new.from_json("{title: 'hello world'}")works fine for me.
-
jc-denton
yes it does, thank you. However I don't understand why I get a no method error and not "invalid json string" or something like this
-
Frederick Cheung
That's probably a detail of the JSON parser in rails - if you just give it a string it returns that string whereas if you pass a string in the correct form it returns a hash (which of course causes problem with the code that assumes it has a hash)
-
Frederick Cheung
- State changed from new to invalid
-
jc-denton
does invalid mean closed? It's ok to close it, however I'm unhappy with the error message above..
-
Frederick Cheung
Yes basically. The core issue "does from_json work?" has been addressed. Nicer failure modes would be nice. Please do investigate if you are concerned.