sumeetjain / outcomes-tracker

0 stars 0 forks source link

123 salary formatting #126

Closed halfghaninne closed 8 years ago

halfghaninne commented 8 years ago

Fixes #123


Login Credentials

Your GH profile. You should be able to create a new Job Application (that might mean being a "student" User)


Functionality to Test

sumeetjain commented 8 years ago

If I'm understanding you correctly... Could you try an after_initialize callback in the Salary model?

halfghaninne commented 8 years ago

Just saw this, sorry.

I think it will be too late. Upon initialization, the Salary's amount gets truncated to 30.

I suppose I could do some work like...

after_initialize :do_the_thing

def do_the_thing
   # if rate == 0 amount should be multiplied by 1000, probably
   # continue to make other assumptions based on rate of the Salary object
   # which I don't like and was trying to avoid for some reason
end

If that is the approach I take, I don't see much difference between using an after_initialize and before_save callback.