- Improved clarity of error when accessing uninitialized attributes. (#71)
- doc: Minor document adjustments, etc.
- Avoid issuing multiple saves on the same object. (#56)
- The storage of
#modelshas been changed from an Array to a Set. This prevents duplicate additions of the same object and option combinations. Also,#models#deletenow deletes the model regardless of the options used when it was added. (#57) - Adding an
ActiveRecordCompose::Modelto#modelsnow throws an error if there is a circular reference. (#58)
- fix: the save method would return nil instead of false.
- doc: We've simplified the documentation comment yard.
- Implemented ActiveRecord-like #inspect
In activerecord's
#inspect, the string is a list of attributes, and we have reproduced a similar format. (#45) .with_connection.lease_connectionand.connectionare deprecated. UseActiveRecord::Base.with_connectionetc. instead. (#46)- refactor: Remove
ActiveRecord::Transactionsmodule dependency (#44)
- Removed the private interface
composite_primary_key?This was previously an internal ActiveRecord dependency, but was not exposed in the release version. (#39) - Relaxed ActiveRecord dependency upper bound to < 8.2 (#42)
- drop support rails 7.0.x
- Omits default arguments for
#updateand#update!. It's to align I/F with ActiveRecord. (#25)#update(attributes = {})to#update(attributes)#update!(attributes = {})to#update!(attributes)
- Omitted Specify instance variables in the
:tooption ofdelegate_attribute. (#29) - Omitted
#destroyand#touchfromActiveRecordCompose::Model. These were unintentionally provided by theActiveRecord::Transactionsmodule. The but in fact did not work correctly. (#27)
- refactor: Aggregation attribute module. (#24)
- Warn against specifying instance variables, etc. directly in the
:tooption ofdelegate_attribute.- Deprecated:
delegate_attribute :foo, to: :@model
- Recommended:
delegate_attribute :foo, to: :model private attr_reader :model
- Deprecated:
- doc: Expansion of yard documentation comments.
ActiveModel::Attributes.attribute_namesnow takes into account attributes declared in.delegate_attribute- relax rubocop config.
- refactor: extract persistence module
- Add upper version.
- refactor: extract Delegation class
- fix: Because
define_attribute_methodswas not executed,#attributeswas evaluated each timeattribute?was called.
#attribute_namesnow takes into account attributes declared in.delegate_attribute- Implemented query methods with a
?suffix for each attribute. Their evaluation behavior is consistent with ActiveRecord. For example:- Defining
attribute :fooallows callingmodel.foo?. - Defining
delegate_attribute :bar, to: :otherallows callingmodel.bar?.
- Defining
- avoid twice validation. As a side effect, save must accept argument
#save(**options). In line with this, the model to be put into models must be at least responsive tomodel.valid? && model.save(validate: false), notmodel.save()(no arguments). - supports context as the first argument of
#valid?, for examplemodel.valid(:custom_context). At the same time, it acceptsoptions[:context]in#save(**options), such asmodel.save(context: :custom_context). However, this is a convenience support to unify the interface, not a positive one.
- removed
persisted_flag_callback_controlsupport. - Omitted
:privateoption fromdelegate_attributebecause, assuming the behavior and use cases ofActiveModel::Attributes.attribute, making it private is unnecessary. - Added the URL for the sample application to the README
- changed
persisted_flag_callback_controldefault fromfalsetotrue. - adjusted to save errors as soon as an invalid is found.
- drop support rails 6.1.x.
- rename ActiveRecordCompose::InnerModel to ActiveRecordCompose::WrappedModel
- rename ActiveRecordCompose::InnerModelCollection to ActiveRecordCompose::ComposedCollection
- A new callback control flag,
persisted_flag_callback_control, has been defined. Currently, the default value is false, which does not change the existing behavior, but it will be deprecated in the future. When the flag is set to true, the behavior will be almost the same as the callback sequence in ActiveRecord. (#11)
- fix: type error in
ActiveRecordCompose::Modelsubclass definitions. - fixed type errors in subclass callback definitions, etc.
- doc: more detailed gem desciption.
- rewrite readme.
- fix:
delegate_attributedefined in a subclass had an unintended side effect on the superclass. - support ruby 3.4.x
- refactor: remove some
steep:ignoreby private rbs. - refactor: place definitions that you don't want to be used much in private rbs.
- make
DelegateAttributedependent onActiveModel::Attributessince it will not change in practice.
- refactor: reorganize the overall structure of the test. Change from rspec to minitest
- ci: fix CI for rails new version.
- refactor: limit the scope of methods needed only for internal library purposes.
- support rails 8.0.x
- add optional value
ifto exclude from save (or destroy).
- remove
:contextoption. use:destroyoption instead. - remove
:destroyoption fromInnerModelCollection#destroy.
- Omitted optional argument for
InnerModelCollection#destroy.InnerModelequivalence is always performed based on the instance of the innermodel. Since there are no use cases that depend on the original behavior.
- support
destrpyoption. and deprecatedcontextoption.:contextwill be removed in 0.5.0. Use:destroyoption instead. for example,models.push(model, context: :destroy)is replaced bymodels.push(model, destroy: true)models.push(model, context: -> { foo? ? :destroy : :save })is replaced bymodels.push(model, destroy: -> { foo? })models.push(model, context: ->(m) { m.bar? ? :destroy : :save })is replaced bymodels.push(model, destroy: ->(m) { m.bar? })
destroyoption can now be specified with aSymbolrepresenting the method name.
- ci: removed sqlite3 version specifing for new AR.
delegate_attributeoptions are now specific and do not acceptprefix
- use steep:ignore
- support
ActiveRecord::Base#with_connection - rbs maintained.
- relax context proc arity.
- purge nodoc definitions from type signature
- support
ActiveRecord::Base#lease_connection
- strictify type checking
- testing with CI even in the head version of rails
- consolidate the main process of saving into the
#savemethod - leave transaction control to ActiveRecord::Transactions
- execution of
before_commit,after_commitandafter_rollbackhook is delayed until after the database commit (or rollback).
- in
#save(without bang),ActiveRecord::RecordInvaliderror is not passed outward.
- add i18n doc.
- add sig/
- add typecheck for ci.
- avoid executing
#save!fromModel#save - on save, ignore nil elements from models.
- remove
add_development_dependencyfrom gemspec - add spec for DelegateAttribute module
- add and refactor doc.
- add doc for
#saveand#save!. - implement
#savefor symmetry with#save! - add
InnerModel#initializedoc.
- when invalid, raises ActiveRecord::RecordInvalid on #save!
- remove uniquely defined exception class.
- fix documentation uri.
- fix and add doc.
- add development dependency
- avoid instance variable name conflict (
@modelsto@__models) - add #empty?, #clear to InnerModelCollection
- add #delete to InnerModelCollection
- fix 0.1.0 release date.
- add doc.
- Make it easier for application developers to work with
#models
- Initial release