Wednesday, 21 August 2013

How do I use values_at in a before_save method?

How do I use values_at in a before_save method?

I'm trying to pass the year, month, and date from :date to :start_time but
I'm getting the following error: undefined method `values_at'. I think I
don't have the syntax quite right in my method:
def set_start_time_date
self.start_time = date.values_at( :year, :month, :day )
return true
end
before_save :set_start_time_date
What's the correct way to do this?

No comments:

Post a Comment