This repository is a playground around various ways to handle prices with ActiveRecord.
Uses a decimal column to implement the price attribute.
Issue: price_before_type_cast
will equal nil
even if you pass a blank string, so you cannot rely on price_before_type_cast
to provide a different treatment to a blank input if needed.
Links:
- composed_of (which was removed, then is back for now)
- custom accessors as advised on the commit that first removed composed_of
- money-rails (which implements a certain version of custom accessor)
Create db/config.yml
based on 'db/config.yml.sample' then run:
bundle install
bundle exec rake db:create
bundle exec rake db:migrate
bundle exec rake spec