I'm trying to figure out a way to calculate bonuses or penalties from a Character's Statistics, and then apply that method in other Models' views to calculate things like Fortitude saves, attack bonuses and so on. I've been working with a modifier for Constitution and here's what I've got so far.
The logic for calculating a Statistic bonus/penalty is (statistic - 10) / 2. So for a score of 14, we get 2, and for a score of 8, we get -1. Not bad so far!
So I define this method in Statistic controller:
(constitution.to_i - 10) / 2
@con_modifier = @character.statistic.con_modifier
Here's the logic for calculating a total in my Fortitude model right now:
fortitude_base.to_i + ability.to_i + magic.to_i + misc.to_i
fortitude_base.to_i + @con_modifier + magic.to_i + misc.to_i
nil can't be coerced into Fixnum