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
Using #last on a Relation, after a using #combine, ignores the combine and just returns the regular tuple.
To Reproduce
require"rom"Types=Dry.Types()moduleStructsclassArticle < ROM::Struct# Including `title` and `body` is optional, we are able to declare struct-only attributes# If you comment these two lines out, we get the same result and same errorattribute:title,Types::Stringattribute:body,Types::Stringattribute:favorites_count,Types::Integerendendrom=ROM.container(:sql,"sqlite::memory")do |conf|
conf.default.create_table(:articles)doprimary_key:idcolumn:title,String,null: falseendconf.default.create_table(:tags)doprimary_key:idforeign_key:article_idcolumn:value,String,null: falseendconf.relation(:articles)doschema(infer: true)doassociationsdohas_many:tagsendendendconf.relation(:tags)doschema(infer: true)doassociationsdobelongs_to:articleendendendendarticles=rom.relations[:articles]tags=rom.relations[:tags]articles.combine(:tags).command(:create).call(title: "First",tags: [{value: "worst"}])articles.combine(:tags).command(:create).call(title: "Second",tags: [{value: "best"}])puts"✅ articles.combine(:tags).first:"puts" " + articles.combine(:tags).first.inspectputsputs"❌ articles.combine(:tags).last: (MISSING TAGS!)"puts" " + articles.combine(:tags).last.inspectputsputs"✅ articles.combine(:tags).reverse.first:"puts" " + articles.combine(:tags).reverse.first.inspect
Describe the bug
Using
#last
on a Relation, after a using#combine
, ignores thecombine
and just returns the regular tuple.To Reproduce
Outputs:
Expected behavior
I would expect it would work just like
articles.combine(:tags).reverse.first
.My environment
Related issues
#64
The text was updated successfully, but these errors were encountered: