Displaying 2 results from an estimated 2 matches for "ghoti143".
2006 Jun 07
0
making a date object default to the last day of the month
hello all...question from a newbie trying to make a go at rails....
i have an account object which holds sundry information including a
credit card expiration date. i use date_select ( "object", "method",
:order => [:month :year] ) to allow the user to select the month and
year of his credit card''s expiration, but when this info is sent to the
model, somehow
2006 Jun 08
2
how to add plugin to ActiveRecord
I''m trying to set a date field''s day to the last day of the month before
I save it. I can do this successfully now using this code:
class Account < ActiveRecord::Base
def before_save
self.exp_date = last_day_of_month(self.exp_date)
end
# Returns a Date object set to the last day of the current month
def last_day_of_month(date = Date.today)
next_month_str