You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BlockScore::Collection#all where it previously requested all items in the member resource it nows returns self. This could have lead one to falsely assume something like person.question_sets.all returned a collection that contained question sets belonging to the person. The collection itself is now just tied to the embedded member ids in the parent resource. This could introduce a breaking change for those expecting Collection#all to behave like QuestionSet#all.
Fixes BlockScore::Person to automatically add previously created question set ids to the BlockScore::Person#question_sets collection
Breaking Changes
BlockScore::Collection#all returns self and no longer delegates to the member class method.
BlockScore::Collection#retrieve no longer accepts options and returns BlockScore::Collection::Member simple delegator around member instance
BlockScore::Collection#create returns BlockScore::Collection::Member simple delegator around instance
Some Improvements
Attributes in BlockScore::Base are lazily loaded when retrieved and maybe refreshed using BlockScore::Base#refresh or BlockScore::Collection#refresh. This allows the QuestionSet id's included in the person attributes to be lazily loaded into a collection.
BlockScore::Collection#refresh reloads the persisted and associated members of the parent, but may leave out or not contain items if parent is not refreshed.
BlockScore::Collection#create will include parent id automatically and add to collection, e.g. person.questions_sets.create is handles adding the person_id and adding the created question set to the collection, which was previously handled by QuestionSet.
Creation fails if parent is not saved, e.g. person.question_sets.create fails if person.persisted? is false.
BlockScore::Collection#retrieve checks parent id and fails if not belonging.
BlockScore::Collection#new adds parent id to new member