Hi everybody.

Look at this code:

class Foo < Sequel::Model
  one_to_many :bars
end

class Bar < Sequel::Model
  many_to_one :foo
end

f = Foo.new
b = Bar.new
b.foo = f
f.bars                 # => []

f2 = Foo.new
b2 = Bar.new
f.bars                 # Magic line!
b2.foo = f2
f2.bars                # => [b2]


I think first case should return same that second case.

We continue with the example:

f2.save                # Foo object with id 1 and a bar child

b3 = Bar.new(foo_id: 1)
f3 = b3.foo
f3.bars                # => [f2]


In this case, I think it should return [f2, f3]

Do you see these requirements logical? If we have reciprocal and object
assignation, I think these are two annoying Sequel effects that go against
"least surprise" principle.

Greets.

--
David

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sequel-talk+unsubscr...@googlegroups.com.
To post to this group, send email to sequel-talk@googlegroups.com.
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to