Hi,

I am using rails 3.1.3 and ruby 1.9.3 with postgresql 9.1.

Also, I am working from a tutorial and I have only two records in my
database at this time.

I initially setup the default setting for the dates in the database to
follow this format: '1979-09-21', but I would like to change this to:
'09-21-1979'.

I first tried to use pgadmin3 and then to go into the date fields and
change them to the format I indicated above. This did nothing since in
my rspec model and controller I have the tests setup to the old format,
namely: '1979-09-21'.

So, I thought I could change the date formats in my rspec model and
controller files, but then my tests failed. Next I thought I could
delete the date field of concern from my database and then use a
migration to add it back, but this time without a default.

Nope, none of this seemed to work because the date of concern still
appears in my database as '1979-09-21'. Well the only other conclusion I
could come to is that I do not understand where the format for the date
fields are being set.

Thankfully I turn to this forum and hopefully one of you learned rails
practitioners can point me to a path that will not only solve my dilemma
but will also lead to my edification on what is happening in rails with
the date format?

Thanks for any help, suggestions or pointers that you care to share.

fuzzy.

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Hassan Schroeder at Dec 28, 2011 at 9:25 pm

    On Wed, Dec 28, 2011 at 10:43 AM, Tom Tom wrote:

    I initially setup the default setting for the dates in the database to
    follow this format: '1979-09-21', but I would like to change this to:
    '09-21-1979'.
    Why would you care about the internal format of a Date in the DB?
    Let ActiveRecord and your database adapter take care of that.

    If your code deals with dates, use Date or DateTime -- not a String
    masquerading as a date. :-)

    And apologies in advance if I've misunderstood your issue.

    --
    Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
    http://about.me/hassanschroeder
    twitter: @hassan

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedDec 28, '11 at 6:44p
activeDec 28, '11 at 9:25p
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Hassan Schroeder: 1 post Tom Tom: 1 post

People

Translate

site design / logo © 2022 Grokbase