Passing a calculated value in a hidden_field

I have a calculated number that I wish to use to send as a value in a hidden_field in a form. This started out as a question, but I figured it out so I'll post it anyway as a FYI for Ruby Noobs like me or if anyone can think of a smarter way.

A few points: *The value is calculated in the controller and assigned to an instance variable *The 'TimeOff' model is in a has_many relationship with the 'Employee' model (An Employee can take many days off). *The resulting value is being passed as a hidden_field to populate the table 'time_offs'

Either of these work:

     <%= hidden_field "time_off", "hours_left", :value => "#{pto_accrued}" %> <%= hidden_field "time_off", "hours_left", :value => @pto_accrued %>

Below is my code:

# Employee Model