Displaying 1 result from an estimated 1 matches for "attrs_to_manag".
Did you mean:
  attrs_to_manage
  
2007 Jun 27
0
ActiveRecord Type issue -- What am I missing?
...this in PHP with no problem -- just store the actual value
*
100, and always divide by 100 when reading from the db. Should be
simple...
I set up a callback based on the "Encrypter" example in the excellent
Agile Web Dev w/ rails book. Callback is as follows:
def after_save(model)
    @attrs_to_manage.each do |attr|
      res = model[attr[0]].to_f / (10.0**attr[1])
      model[attr[0]] = res
      RAILS_DEFAULT_LOGGER.info "   Result: #{model[attr[0]].inspect}
(class=#{model[attr[0]].class}, model=#{model.inspect})"
    end
  end
I tried that thinking I was all set. I am puzzled by t...