From: Juan Matias on 13 Apr 2010 11:21 There's a workarount you can do, in /usr/local/lib/ruby/1.8/yaml/rubytypes.rb you have this definition of #to_yaml on Date class. 1 class Date 2 yaml_as "tag:yaml.org,2002:timestamp#ymd" 3 def to_yaml( opts = {} ) 4 YAML::quick_emit( self, opts ) do |out| 5 out.scalar( "tag:yaml.org,2002:timestamp", self.to_s, :plain ) 6 end 7 end 8 end What I do in my Rails app is to overide this implementation, 1 class Date 2 yaml_as "tag:yaml.org,2002:timestamp#ymd" 3 def to_yaml( opts = {} ) 4 YAML::quick_emit( self, opts ) do |out| 5 out.scalar( "tag:yaml.org,2002:timestamp", self.to_s(:utc), :plain ) 6 end 7 end 8 end "self.to_s(:utc)" is the difference in line 5.It works for me. I hope this help. Bye. Juan Matias. -- Posted via http://www.ruby-forum.com/.
|
Pages: 1 Prev: IronRuby 1.0 has been released Next: How to find multiple matches in a string |