danderson,
@danderson@hachyderm.io avatar

Me, an idiot: I'll just convert this one-many relation into many-many through a join table, it'll be fine.

Business logic layer: explodes in a shower of complexity

danderson,
@danderson@hachyderm.io avatar

Definitely feeling the full force of Framework Love now.

Oh what's that, creating an object is now a complex operation requiring multiple queries and some cross-table validation? Haha fuck you nothing you've used so far works any more, enjoy your everything being full of suck asshole

command_tab,
@command_tab@hachyderm.io avatar

@danderson Not sure if using Python, but SQLAlchemy has association_proxy to help “hide” the existence of the mapping table.

danderson,
@danderson@hachyderm.io avatar

@command_tab Not python, but Ecto (in Elixir) has similar facilities... However, in explicitly need to not hide the association table, because in this relation the association table carries additional data.

It's all possible, I just... need to grok how to plumb it through the layers of form helpers and data validators and all that.

command_tab,
@command_tab@hachyderm.io avatar

@danderson Oh man, mapping tables with additional important columns are, in fact, full of suck. On one hand, the normalization accurately captures the data, but on the other hand, <confused math lady gif>

danderson,
@danderson@hachyderm.io avatar

@command_tab Yup. I essentially spent all day doing the various two-choices memes between correct normalized entity graph vs. denormalized pile of poo, and mostly concluding that computers were a mistake :)

danderson,
@danderson@hachyderm.io avatar

Okay, okay. It seems the root of my woes here is partly that the stock scaffolding uses a single form for creating and editing, whereas I'm about to make those flows diverge real hard. If I first peel apart the create and edit states, I think the complexity collapses back into something more manageable.

I... think. It's still a bid mind-bending.

danderson,
@danderson@hachyderm.io avatar

The other part of the problem is that I've been deferring getting to grips with Ecto's query DSL and the full force of changeset management, and... yeah, this is the point where I have to actually figure my shit out.

danderson,
@danderson@hachyderm.io avatar

Arright, interestingly, if I start the insert process from the join table record, I think... it might just end up being quite easy? Maybe?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • everett
  • tacticalgear
  • magazineikmin
  • thenastyranch
  • rosin
  • tester
  • Youngstown
  • khanakhh
  • slotface
  • ngwrru68w68
  • kavyap
  • mdbf
  • InstantRegret
  • megavids
  • osvaldo12
  • GTA5RPClips
  • ethstaker
  • normalnudes
  • Durango
  • cisconetworking
  • anitta
  • modclub
  • cubers
  • Leos
  • provamag3
  • JUstTest
  • lostlight
  • All magazines