hi all,
I want to make a rake task.
It contains birthday_year as varchar column and birthday_date as
varchar.
And it should calculate age as int column
I am selecting users from database like this,
@users = User.find(:all, :conditions => [“deleted = 0 created_at > ?”,
1.day.ago.to_s])
for user in @users
how can I do this part???
end
My table structure looks like this
username birthday_year birthday_date age created_at
aaa 1990 8 8 2009-12-14 11:02:16.000
abb 8 8 2009-12-15 12:02:16.000
abc 1980 2009-12-15 12:02:16.000
ccc 1980 01 01 2009-12-15 12:02:16.000
for this indicator, “aaa” and “ccc” have got correct dates and I want to
calculate their ages and update the their age columns.
I hope explained it clearly.
How can I do it? Please help me.