Displaying 2 results from an estimated 2 matches for "at_beginning_of_day".
2006 Apr 21
2
Using before_create and conflicting setter method...
...--------------
-------
def set_campaign_start
self.campaign_start = Time.now
end
# We want the date to always start at midnight
#-----------------------------------------------------------------------
-------
def campaign_start=(new_time)
@campaign_start = new_time.utc.at_beginning_of_day
end
It sets @campaign_start in the object, but not the actual attribute,
and therefore not in the DB. If I remove the setter method, the
before_create works great. What is the correct way to do this?
Thanks,
Brett
2006 Jul 28
4
add one month or one year to a date
Hi,
I need to be able to add one month or in some cases on eyear to a Date.
Does anyone know of any easy ways of doing this?
thanks
scott
--
Posted via http://www.ruby-forum.com/.