My database has a column called birthday.
The model has a method:
return (birthday.nil? ? -1 : DateTime.now.year - birthday.year)
When called from a validation method on a new record, I get:
NameError in 'User should be valid'
undefined local variable or method `birthday' for #<User:0x3285e58>
My interpretation after some experimenting is that because it's a new
record and birthday is not initialized, activerecord doesn't give me
an accessor called birthday.
What is the 'proper' way to write the age method?