I am trying to format my dates in the YYYY-MMM-DD manner. I have a en.yml file that has it specified.
formats:
default: ! '%Y-%b-%d'
I have also created a date_time_formats.rb in my initializers folder.
Date::DATE_FORMATS[:default] = '%Y-%b-%d'
Time::DATE_FORMATS[:db]= '%Y-%b-%d'
I have also tried placing the same code directly in my environments.rb file. If I test out the defaults in the console Date.now.to_s then I get what I expect in return, “2012-Nov-10”, but in my view I always see “2012-11-10”.
I have tried saving it in the controller with Date.now and Date.now.to_s, but I still get the same result.
I must be missing something simple, so any help will be appreciated.
I found the answer to my question, although I dont understand why. Here is a Stack answer that explains it here
Basically I added these 2 lines of code to my environment.rb.
And now everything works as planned. I looked for the documentation on the merge function to get a better understanding, but did not have any luck.