create a new file under /lib directory ... i.e /lib/format.rb
then overwrite from the file

class Date
   module format
      MONTHS = { }   # overwrite here
   end
end

overwriting a constant will result a warning!


Jermaine wrote:
> Hello Everyone,
> 
> in the 1.8/usr/lib/ruby/1.8/date/format.rb file there is the following
> code:
> 
> ------------------------------------------------------------------------------------------------------
> class Date
> 
>   module Format # :nodoc:
> 
>     MONTHS = {
>       'january'  => 1, 'february' => 2, 'march'    => 3, 'april'    =>
> 4,
>       'may'      => 5, 'june'     => 6, 'july'     => 7, 'august'   =>
> 8,
>       'september'=> 9, 'october'  =>10, 'november' =>11, 'december'
> =>12
>     }
> ------------------------------------------------------------------------------------------------------
> 
> How can I "overwrite" these values via my rails app? I'm trying to
> submit a foreign date to the database, so I want to overwrite
> (translate) this piece out of the format.rb file in my rails app, so
> that it understands which month I'm talking about.
> 
> Any suggestions/tips how I can fix this in a smart/efficient way?
> 
> Many Thanks in advance!


--~--~---------~--~----~------------~-------~--~----~
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