Class: TypedEAV::Field::RangeBounded
- Inherits:
-
Base
- Object
- ActiveRecord::Base
- ApplicationRecord
- Base
- TypedEAV::Field::RangeBounded
- Defined in:
- app/models/typed_eav/field/range_bounded.rb
Overview
Intermediate STI base for field families that constrain a single
comparable value by min/max bounds.
Leaves: Field::Integer, Field::Decimal, Field::Date,
Field::DateTime. Field::Percentage keeps its < Decimal chain
(so the new full chain is
Percentage < Decimal < RangeBounded < Base).
Does NOT declare a value_column — each leaf still owns its typed
column (integer_value, decimal_value, date_value,
datetime_value). The family is identified by "has min/max bounds",
not by storage shape.
Hoists the protected validate_range / validate_date_range /
validate_datetime_range helpers previously kept on Field::Base.
Each leaf declares its own store_accessor (:min/:max for
Integer/Decimal; :min_date/:max_date for Date;
:min_datetime/:max_datetime for DateTime) and its own
validates :max, comparison: { greater_than_or_equal_to: :min }
macro using the appropriate key names. Adding the macro to
Date/DateTime in-slice closes a latent-bug gap previously only
caught on Integer/Decimal.
Public extension point: external authors can subclass this directly if they want a typed numeric/temporal column with min/max guards (see README §"Custom field types"). STI dispatch is unaffected.
Constant Summary
Constants inherited from Base
Constants included from TypedStorage
TypedStorage::DEFAULT_OPERATORS_BY_COLUMN, TypedStorage::FALLBACK_OPERATORS
Method Summary
Methods inherited from Base
#allowed_option_values, #array_field?, #backfill_default!, #cast, #clear_option_cache!, #default_value, #default_value=, #display_name, export_schema, #field_type_name, import_schema, #insert_at, #move_higher, #move_lower, #move_to_bottom, #move_to_top, #optionable?, #validate_typed_value
Methods included from TypedStorage
#after_snapshot, #apply_default, #before_snapshot, #read_value, #value_changed?, #write_value