Aaron Broad wrote:
> Super improved:
> 
> require 'date'
> require 'rubygems'
> require 'active_record'
> 
> module RubyToJadeXML
>   def jadexml
>     self.strftime(fmt='%FT%T.000')
>   end
> end
> 
> DateTime.class_eval do
>   include RubyToJadeXML
> end

You don't need class_eval to reopen a class.  Just use "class DateTime", 
same as if you were defining from scratch.

> 
> ActiveSupport::TimeWithZone.class_eval do
>     include RubyToJadeXML
> end
> 
> p DateTime.now.jadexml
> p ActiveSupport::TimeZone.new("Atlantic Time (Canada)").now.jadexml
> 
> Thanks again,  Now where would you recommend I put this in a Rails
> app?
> Aaron
> 
> On Sep 30, 8:57�pm, Robert Walker <rails-mailing-l...@andreas-s.net>

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to