Mongoid causing error whenever I use gem command
Earlier today I added the mongoid gem version '2.0' to an app. Ever since then, any time I use the gem command I get the following errors:
开发者_Go百科Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/mongoid-2.1.0.gemspec]: invalid date format in specification: "2011-07-31 00:00:00.000000000 %:z"
Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/mongoid-2.1.7.gemspec]: invalid date format in specification: "2011-08-08 00:00:00.000000000Z"
Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/mongoid-2.1.0.gemspec]: invalid date format in specification: "2011-07-31 00:00:00.000000000 %:z"
Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/mongoid-2.1.7.gemspec]: invalid date format in specification: "2011-08-08 00:00:00.000000000Z"
Any idea how to fix this?
This is a known issue with recent versions of Mongoid. There are some fixes on the Mongoid Github page, but in my case they did not work.
The solution for me was to uninstall the mongoid gem and then reinstall the 2.0.1 version.
gem uninstall mongoid
gem install mongoid --version "2.0.1"
I had the same problem with mongoid 2.1.9, and fixed the problem by modifying the s.date assignment in the mongoid-2.1.9.gemspec file mentioned in the errors. In my case, the end result was this:
s.date = %q{2011-08-21}
精彩评论