Clean way to handle prices

As someone else mentioned, wrapping this conversion to dollars makes
it a lot easier to manage.

The stack too deep problem in your overloading of price and price=
should be able to be solved by using the direct accesors like so:

def price
  cents_to_dollars(read_attribute(:price))
end

def price=(value)
  write_attribute(:price, dollars_from_cents(value))
end

or however you want to manually manage the accessors, just make sure
when overloading you use the read_attribute, and write_attribute,
because if you simply use the variable as normally, you will be
calling the same method you are defining, causing the stack too deep
error.

or however you want to manually manage the accessors, just make sure
when overloading you use the read_attribute, and write_attribute

That's exactly what I was looking for! I couldn't find these methods in
railsbrain because they are private, therefore no documentation is
generated except if you read the very long text at ActiveRecord::Base.

Thank you very much.