Shopify / measured-rails

Rails adapter for the measured gem. Encapsulate measurements and their units in Ruby and Rails.
MIT License
92 stars 13 forks source link

Rb 49 custom value field support #67

Closed Steffylicious closed 3 years ago

Steffylicious commented 3 years ago

WHY

The gem currently does not support the ability to define a custom database field for values. This adds support for that.

eg:

class ThingWithCustomValueAccessor < ActiveRecord::Base
  measured_length :length, value_field_name: :custom_length
  measured_weight :total_weight, value_field_name: :custom_weight
  measured_volume :volume, value_field_name: :custom_volume
end
kmcphillips commented 3 years ago

Thank you for your contribution @Steffylicious!

You can use 00254e80e48b3f82d56c8601ce87948c70c9ca3c in your gemfile for now. I'll cut a release this week, but I can't promise today. I'll have to do a minor version bump, and it's version locked to measured so I'll have to bump and release both. I'll let you know here when I do.

kmcphillips commented 3 years ago

Released 2.8.0 today. Surprise!