Skip to content

Instantly share code, notes, and snippets.

View amasses's full-sized avatar

Matthew Lewis amasses

View GitHub Profile
@amasses
amasses / IRB Session
Created January 3, 2010 03:13
Issues with Mongo and Timezones (with Mongoid or MongoMapper gems)
>> x = HelpFile.create(:title => "Test help file", :content => "Hello world!", :is_published => true, :publish_date => Time.now.utc)
=> #<HelpFile _id: test-help-file, title: Test help file, excerpt: Hello world!..., is_published: true, content: Hello world!, publish_date: 28/02/2010>
>> x.publish_date
ArgumentError: invalid date
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/date.rb:1573:in `new_by_frags'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/date.rb:1618:in `parse'
from /Library/Ruby/Gems/1.8/gems/activesupport-2.3.3/lib/active_support/values/time_zone.rb:246:in `parse'
from /Library/Ruby/Gems/1.8/gems/mongoid-0.10.6/lib/mongoid/extensions/time/conversions.rb:12:in `get'
from /Library/Ruby/Gems/1.8/gems/mongoid-0.10.6/lib/mongoid/field.rb:35:in `get'
from /Library/Ruby/Gems/1.8/gems/mongoid-0.10.6/lib/mongoid/attributes.rb:32:in `read_attribute'
@amasses
amasses / Rails_Template.rb
Created September 8, 2009 07:37
My base rails template
# Template created by You've Got Rails (http://www.youvegotrails.com)
# Remove unnecessary Rails files
run 'rm README'
run 'rm public/index.html'
run 'rm public/favicon.ico'
run 'rm public/images/rails.png'
# Remove Prototype files