hanami / model

Ruby persistence framework with entities and repositories

Home Page:http://hanamirb.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Associations don't seem to work well with as: aliases.

TheTharin opened this issue · comments

Hey there! I can't successfully use has_many :books with as: :journals alias in repositories due to ROM::RelationRegistry error popping up when I try to assoc(:journals, author).add(title: 'Something')

Here's the link to the gist to reproduce the bug: https://gist.github.com/TheTharin/39f9b2db96440ae3b7a9259c861651ef#file-assoc_bug-rb

If you replace :journals to :books on line 60 - it won't work either. Only if you remove as: alias.

Hello @TheTharin . I'll take a look into this, thanks for reporting.

@mereghost you're welcome! :)

Heya @TheTharin good news & bad news.

Aliases are kinda borked as 1.3 is still using ROM 3, that gets kinda lost with them. Good news is that we are getting the release of model 2.0 wrapped up, that which will include ROM 5 which should sort the problem out (solved on my contrived tests at least).