I'm trying to use the guidance here to convert my date format in my model. The reason I am doing this is I want my user to see the date format as 7/20/2014, but I need to save that date into the database as 2014-7-20. I tried to implement that with this code, but it is not changing the date format when creating or reading:
class Inquiry < ActiveRecord::Base
belongs_to :user
def date_requested
read_attribute(:date_requested).strftime("%m/%d/%Y")
end
def date_requested=(date_requested)
write_attribute(:date_requested, date_requested.strftime("%Y-%m-%d"))
end
end