rolfb has quit [Read error: Connection reset by peer]
rolfb_ has quit [Quit: Leaving...]
skade has quit [Ping timeout: 252 seconds]
jordanyee has quit [Read error: Connection reset by peer]
jordanyee has joined #rom-rb
therabidbanana has joined #rom-rb
solnic has joined #rom-rb
snusnu has joined #rom-rb
<snusnu>
yo solnic
<solnic>
hey snusnu
jordanyee has quit [Quit: MacBook went to sleep.]
solnic has quit [Quit: Leaving...]
solnic has joined #rom-rb
<solnic>
snusnu: hello?
<snusnu>
solnic: sry, vim was fullscreen :)
<solnic>
snusnu: LIKE IT SHOULD BE
<snusnu>
ofcoursedude
<snusnu>
:p
skade has joined #rom-rb
<snusnu>
anyways, i was wondering what your thoughts on rename wrt wrap/group are
<solnic>
snusnu: did you switch to tmux+vim finally? :)
<snusnu>
no, not yet :)
<solnic>
snusnu: ok?
<solnic>
what rename? example?
<snusnu>
so when you wrap a tuple, and you have to rename some of the wrapped attributes for a join .. how do you rename it "back" to their original names inside object?
<snusnu>
say i have an account model with {id, login} and a person model with {id, name, account_id} .. i need to people.join(accounts.rename(id: :account_id)).wrap(account: [:account_id, :login])
<snusnu>
but i want that wrapped account to have id, not account_id
<snusnu>
and i don't want account_id in the person model
<snusnu>
i was talking to dkubb about this quite a while ago (it was september last year iirc)
<snusnu>
iirc he suggested that axiom might eventually just prefix all attributes in a wrapped/grouped relation with the relation name, but somehow i don't think that'll work, because not every relation has a name
<solnic>
snusnu: I added a way to rename stuff in schema and then map it again in mappers to something else
<solnic>
so in schema I'd set things so they are naturally joinable
<snusnu>
yeah, i have my DM1 model key fields set to be naturally joinable too, but i don't yet have the "renaming back" part
<snusnu>
one sec
<snusnu>
yeah, so that seems to be the part where you allow "backend" attr names to differ from relation attr names … "but" i need the renaming for wrap/group :p
<solnic>
yes it works with wrap/group
<snusnu>
the rom specs i saw actually don't exhibit the behavior i desire
<snusnu>
what i need is this (example syntax, not suggesting that): people.join(accounts.rename(id: :account_id)).wrap(account: [{original: :account_id, mapped: :id}, :login])
<solnic>
do you have a spec?
<solnic>
yeah that is achievable by renaming stuff in schema
<solnic>
so you don't have to rename it later
<solnic>
oh wait
<snusnu>
;)
<solnic>
I see what you did there
<solnic>
yeah I stumbled upon this use case
<solnic>
I don't think it can be done right now given how axiom handles that
<snusnu>
exactly
<solnic>
it basically moves stuff from the tuple to wrapped one
<solnic>
after that you can't change it
<snusnu>
right
<solnic>
yep
<solnic>
full ack
<snusnu>
damnit
<solnic>
good bye
<solnic>
;D
<snusnu>
lol
<snusnu>
imo raw axiom should support that in some way
<snusnu>
it's completely natural behavior
<snusnu>
wrap/group "make no sense" if it leaves you with meaningless names
<solnic>
that is correct
<solnic>
I'm also not sure if it's OK that it moves everything w/o giving you ability to leave certain things on both sides
<snusnu>
also i'm somewhat doubtful that some automatic prefixing/whatevering will work for the general case
<snusnu>
that's just a guess tho
<solnic>
like, if there's a common attribute (used to join things) it will be moved
<solnic>
you can't have it on both sides
<solnic>
it kinda makes sense from the theory POV
<snusnu>
hm, not sure if that's a real problem, "unwrap" should take care of that?
<snusnu>
also, it's mostly about FKs i guess? they should be "gone" in object land anyway?
<solnic>
yes
<solnic>
only FKs, actually
<solnic>
true that
<solnic>
that's why I'm not super worried about it ;)
<snusnu>
yeah, it's a matter of LoD
<snusnu>
me too
<solnic>
LoD is shit, don't forget
<snusnu>
lol
<snusnu>
just sayin' (for reference) if you want person.account_id you can always do def account_id; account.id; end
<snusnu>
anyways, what are we going to do about the core renaming issue?
<snusnu>
solnic: i got it almost working in axiom (the wrap thing) but then i decided to use the same approach you took in rom, renaming the field in the mapper, cause as it happens, my mapper already supported it
<snusnu>
solnic: also, it's much more straightforward to do
<solnic>
hah!
robmiller has joined #rom-rb
<snusnu>
solnic: another question tho, how come axiom-do-adapter generates sql errors when i wrap a wrapped relation with a gateway?
<snusnu>
solnic: (re the first thing, all i had to do was add a map :id, from: :account_id :)
<snusnu>
when i create a gateway relation proxying down to an already wrapped relation, the do-adapter produces a sql error
<snusnu>
when i only wrap the join in a gateway, and perform the wrap on that, the correct sql gets generated
<snusnu>
did you experience the same in rom?
<solnic>
no I don't have that case yet
<solnic>
it's dynamic now
<solnic>
as in - rom doesn't build its relations with wrap/group yet
<solnic>
you can do it dynamically yourself for now
<solnic>
like I show in the demo
<snusnu>
ah ok, well, then it's weird axiom behavior (bug)
<snusnu>
imo it should be possible to create a join that gets then wrapped .. then wrap that in a gateway, and still have it execute the sql first, and wrap afterwards
<solnic>
yeah man I would expect it to work
<snusnu>
so yeah, now you know that it doesn't :p
<snusnu>
i don't care much, but yeah, it clutters schema access code
<solnic>
:/
<snusnu>
then again, i'll just add #wrap and #group to my schema object for now
<snusnu>
i guess i'll have something to show to you by tomorrow
<solnic>
nice
snusnu has quit [Quit: Leaving.]
snusnu has joined #rom-rb
robmiller has quit [Quit: Leaving.]
robmiller has joined #rom-rb
<snusnu>
solnic: do you know if conceptually, axiom supports nested wraps/groups ?