Releases: BlockScore/blockscore-ruby
Releases · BlockScore/blockscore-ruby
v4.2.0
Fixes
BlockScore::Collection#allwhere it previously requested all items in the member resource it nows returns self. This could have lead one to falsely assume something likeperson.question_sets.allreturned 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 expectingCollection#allto behave like QuestionSet#all.- Fixes
BlockScore::Personto automatically add previously created question set ids to theBlockScore::Person#question_setscollection
Breaking Changes
BlockScore::Collection#allreturns self and no longer delegates to the member class method.BlockScore::Collection#retrieveno longer accepts options and returnsBlockScore::Collection::Membersimple delegator around member instanceBlockScore::Collection#createreturnsBlockScore::Collection::Membersimple delegator around instance
Some Improvements
- Attributes in
BlockScore::Baseare lazily loaded when retrieved and maybe refreshed usingBlockScore::Base#refreshorBlockScore::Collection#refresh. This allows the QuestionSet id's included in the person attributes to be lazily loaded into a collection. BlockScore::Collection#refreshreloads the persisted and associated members of the parent, but may leave out or not contain items if parent is not refreshed.BlockScore::Collection#createwill include parent id automatically and add to collection, e.g.person.questions_sets.createis handles adding theperson_idand adding the created question set to the collection, which was previously handled byQuestionSet.- Creation fails if parent is not saved, e.g.
person.question_sets.createfails ifperson.persisted?isfalse. BlockScore::Collection#retrievechecks parent id and fails if not belonging.BlockScore::Collection#newadds parent id to new member
Updates retrieve to be lazy
- BlockScore::Actions::Retrieve::ClassMethods#retrieve
Adds methods in Base
- BlockScore::Base#force!
- BlockScore::Base#id
- BlockScore::Base#persisted?
Updates methods in Base
- BlockScore::Base#attributes
- BlockScore::Base#inspect
- BlockScore::Base#initialize
Updates Collection with Actions
- BlockScore::Collection#all
- BlockScore::Collection#new
- BlockScore::Collection#refresh
- BlockScore::Collection#create
- BlockScore::Collection#retrieve
- BlockScore::Collection#parent
- BlockScore::Collection#parent_name