Hello
i have a custom query which is getting max number from one of column.
I want to get that number increment by 1 and then save that in
different table. please refer following code:
def getmaxphasenumber(templaid)
self.find_by_sql("select max(templateid) from templates")
end
maxnumber = Templatephases.getmaxphasenumber(templateid)
if !maxnumber.blank?
tmpnumber = maxnumber + 1
else
tmpnumber = 1
end
tmpnumber is returning an error. i tried maxnumber.to_i didnt work.
Please advice
thanks
Ajit