- Changes
- Update ruby gems
- Update rexml gem to patch CVE
- Changes
- Update post install message.
- Update ruby gems
- Changes
- Update ruby gems
- Changes
- Update ruby gems
- Changes
- Update ruby gems
- Relax ruby version requirement to Gem::Requirement.new('>= 3.0.1', '< 4.0')
- Changes
- Update ruby gems
- Changes
- Update ruby gems
- Changes
- Update ruby gems
- Changes
- Update ruby gems
- Changes
- Update ruby gems
- Fix rubocop violations
- Changes
- Update ruby gems
- Bugs
- Fix bug that raised an exception when using
validates_with <Custom Validator>
because#attributes
is not found on custom validators.
- Fix bug that raised an exception when using
- Changes
- You can now use
validates_with <Custom Validator>
by passing the attribute name(s) to your custom validator via the#options
hash with a key of:attributes
OR:fields
. For example:validates_with MyCustomValidator, attributes: %i[field1 field2]
ofvalidates_with MyCustomValidator, fields: %i[field1 field2]
- Updated README.md for the above change.
- Update bundled gems.
- You can now use
- Changes
- Update ruby gems. Remedy activesupport dependabot alert.
- Changes
- Update ruby gems.
- Changes
- Update ruby gems.
- Changes
- Required ruby version is now '~> 3.0'
- Prohibit SimpleCov from starting 2x in spec_helper.rb.
- Changes
- Update gem description in .gemspec.
- Bugs
- Fix bug that did not recognize loaded field values if
attr_accessors
were previously created for the loaded fields due to model validations being present. IfActiveModel
validators are present on the model, DecoLite will automatically createattr_accessors
for the fields associated with the validations. The presence of these fields being automatically loaded prohibited any fields subsequently loaded having the same field names to not be recognized as having been loaded, causing validation to validate incorrectly (the model did not recognize the fields as having been loaded). - Fix bug that wiped out field values previously loaded if
ActiveModel
validations were present for fields having the same name. This is because DecoLite will automatically createattr_accessors
for the fields associated with the validations, initializing these automatically created field vars to be initialized to nil. The auto-creation of theseattr_accessors
was taking place in #initialize AFTER the initial load of any Hash passed to #initialize in the :hash param, so the values loaded were getting nilled out.
- Fix bug that did not recognize loaded field values if
- Changes
- Add specs to test the above scenarios.
- Changes
- Update the README.md file with better explainations and examples.
- Changes
- Update mad_flatter gem to v2.0.0.
- Breaking changes
- Removed
FieldRequireable
and moved this code to theModel
class because determination of required fields loaded is now determined in theModel
class, rather than checking the existance of model attributes. - Removed
RequiredFieldsOptionable
since determination of whether or not required fields were loaded no longer depends on the existance of model attributes, this option was removed.Model#required_fields
model attributes can now be created unconditionally, and still determine whether or not reqired fields were loaded or not. - Since
FieldRequireable
has been removed, along with#required_fields
, theModel#required_fields
can now be overridden or manipulated to designate required fields. Required fields will cause validtion to fail if those fields are not loaded into the model like before. - The reason for the aforementioned changes is that the whole paradigm to validate "required fields" (i.e. fields required when loading a Hash) based on model attributes introduced complexity/awkwardness in using the
DecoLite::Model
class, as well as complexity in theDecoLite
codebase. These changes makes things simpler and cleaner. - Remove deprecated
DecoLite::Model#load
. UseDecoLite::Model#load!
instead.
- Removed
- Changes
- Update README.md file accordingly.
- Changes
- Refactor FieldAssignable to remove call to FieldCreatable#create_field_accessor as this breaks single responsibility rule; which, in this case, makes sense to remove. FieldCreatable#create_field_accessor can be called wherever creation of a attr_accessor is needed.
- Refactor specs in keeping with above changes.
- README.md changes.
- Bugs
- Fix bug where loading fields with the options: { fields: :strict } option raises an error for field that already exists.
- Changes
- Added
DecoLite::FieldRequireable::MISSING_REQUIRED_FIELD_ERROR_TYPE
for required field type errors. - Update README.md with more examples.
- Added
- Changes
DecoLite::Model#new
how accepts a :hash named parameter that will load the Hash as if callingDecoLite::Model.new.load!(hash: <hash>)
.- `DecoLite::Model#new now creates attr_accessors (fields) for any attribute that has an ActiveModel validator associated with it. This prevents errors raised when #validate is called before data is #load!ed.
DecoLite::Model#new
now creates attr_accessors (fields) for any field returned fromDecoLite::Model#reqired_fields
IF the required_fields: :auto option is set.- bin/console now starts a pry-byebug session.
- Changes
- Remove init of
@field_names = []
inModel#initialize
as unnecessary - FieldNamesPersistable takes care of this.
- Remove init of
- Bug fixes
- Fix but that does not take into account option :namespace when determining whether or not a field name conflicts with an existing attribute (already exists).
- Changes
- Change DecoLite::Model#load to #load! as it alters the object, give deprecation warning when calling #load.
- FieldConflictable now expliticly prohibits loading fields that conflict with attributes that are native to the receiver. In other words, you cannot load fields with names like :to_s, :tap, :hash, etc.
- FieldCreatable now creates attr_accessors on the instance using #define_singleton_method, not at the class level (i.e. self.class.attr_accessor) (see bug fixes).
- Bug fixes
- Fix bug that used self.class.attr_accessor in DecoLite::FieldCreatable to create attributes, which forced every object of that class subsequently created have the accessors created which caused field name conflicts across DecoLite::Model objects.
- Bug fixes
- Fix bug that added duplcate field names to Model#field_names.
- Bug fixes
- Fix bug requiring support codez in lib/deco_lite.rb.
- Changes
- Add mad_flatter gem runtime dependency.
- Refactor to let mad_flatter handle the Hash flattening.
- Changes
- Update gems and especially rake gem version to squash CVE-2020-8130, see https://github.com/advisories/GHSA-jppv-gw3r-w3q8.
- Fix rubocop violations.
- Initial commit