Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Railsアプリに日付のフィールドがありますが、値を送信すると、2013-01-12T05:46:01Z無効なjson文字列が表示されます。また、送信しようとし2012-02-14 05:00:00ましたが、これも同じエラーが表示されますが、投稿20120214050000+0000すると日付が受け入れられました。では、どのように日付の値を投稿できますか?
2013-01-12T05:46:01Z
2012-02-14 05:00:00
20120214050000+0000
使用できますTime.parse(string)
Time.parse(string)
または、日付を挿入するモデルにメソッドを追加できます
または、慢性宝石を使用することもできます。
このRails Castを見てください