Hello.
From the little example below, it seems that setting save_on_init=False on a class is ignored
when that class is pointed to by a relationship from another object which IS saved (or selected
from the database, for that matter).
Is this intended behaviour?
See the example below. If you comment out the "addresses" relationship on AddressBook (see #1),
it works as intuitively expected.
#----------[example START]----------------------------
import elixir
elixir.metadata.bind = 'sqlite://'
class AddressBook(elixir.Entity):
addresses = elixir.OneToMany(u'Address') #1
pass
class Address(elixir.Entity):
elixir.using_mapper_options(save_on_init=False)
address_book = elixir.ManyToOne(u'AddressBook')
elixir.setup_all()
elixir.create_all()
book = AddressBook()
new_address = Address(address_book=book)
assert not Address.query.all() # breaks here
#----------[example END]----------------------------