- Proper dirty tracking in record updating, fixes an issue of setting an attribute to
nil
. - Added
has_one
association. - Added
before_load
,after_load
,before_find
andafter_find
callbacks. - Added
before_init
andafter_init
callbacks. - Added
offset
argument to thelimit
criteria. - Added support for Kaminari pagination.
- Fixed dirty tracking for entities returned from
where
andall
. - Fixed a bug where in certain situations duplicated data records are created upon updating an entity.
- Fixed a bug where reversed mapping option
:via
generates wrong join queries. - New API: Added
match
for repository. - Added preliminary support for composed search criteria.
- Added
where
as a composable criteria. - Added
match
as a composable criteria. - Added
limit
as a composable criteria. - Added
order
as a composable criteria.
- Added
- Added experimental support for associations.
- Added
reference_key
option tomap_attribute
. - Added support for ActiveRecord-style attribute-nesting, e.g.
form.fields_for
. - Added validation aggregation for associated entities.
- Added the ability to destroy associated items.
- Added
- Performance optimisations.
- Refactored the way Datamappify walks attributes to allow query optimisations.
- Optimised ActiveRecord queries for entities.
- New API: Introduced
Datamappify.config
for configuring default behaviours. - API change:
where
now replacesfind
for multiple items. - API change:
map_attribute
now takes:to
and:provider
instead of a string for specifying data source. - New API: Introduced
group
for groupingmap_attribute
. - Added support for entity namespaces (closes #4).
- Better attributes inspect. Thanks @jamesmoriarty!
- Added support of
:create
and:update
contexts for validations. - Fixed the persistence when
:via
is specified in the repository.
- Fixed ruby 1.9 compatibility.
- Added support for mapping to namespaced data models.
- Added support for reverse mapping attributes.
- Fixed an issue with attribute name and validation conflicts.
- Enhanced
find
for searching specific attributes. - Added support for repository inheritance.
attributes_from
now copies validations as well!find
now raises an exception if the arguments contain an unknown attribute key.
- Added
all
to repository. - Added
PersistentStates#mark_as_dirty
. - Added
Entity#references
. - Implemented nested composable entities!
- Added dirty attribute tracking.
- Implemented attribute lazy loading!
- Query methods (
find
,save
anddestroy
) no longer support multiple entities.- e.g.
UserRepository.find([1, 2, 3])
is no longer valid.
- e.g.
- Added
exists?
,create
,create!
,update
andupdate!
to repository. - Implemented callbacks (e.g.
before_save
andafter_save
, etc).
- Completely reimplemented Datamappify
- Things are more decoupled and cleaner in general.
- Leaner
Repository
syntax, i.e.UserRepository
instead of the more verboseUserRepository.instance
.
- Fixed the leftover
require 'active_record'
in the code so the gem works without ActiveRecord.
- Completely rewritten Repository
- Repository now handles data construction from different ORM objects.
- ActiveRecord has now been demoted to being a data provider, it is no longer tightly coupled with Repository, this means we could have multiple data providers!
- Repository is now much more robust.
- As a result of robustness, it fixed an issue where updating an existing entity with new data records from mapped attributes will not persist the new data records correctly.
#save
and#destroy
now support accepting an array as their argument.- Added support for Sequel!
- Added support for mapping entity attributes to different ORMs!
- Fixed
#save
for creating new objects. #save
now performs in a transaction.
- Refactored
Repository
.Entity
can now have attributes sourced from differentData
objects. - Removed relationships support - the effort required to make it work is not worth it.
- A total rewrite as a proof-of-concept based on the repository pattern.