"We need to go deeper"
Point free style
Fun with readable code
While that one cures, I added the trench run and got capacitive touch working in the studs.
TLDR I’m looping through a list of all potential association names, using the Reflection API to find one that actually exists, then using private information to get the type of the association, finally creating it the appropriate method.
With comments noting the dodgy bit.
ActiveRecord has a public Reflection API that lets you give you info about scopes/associations, but every class returned is private. One of the few allowed methods is `name` that just gives back what you put in 😡
Outlet.reflect_on_association(:instructors).name == :instructors
A Mastodon instance for Rubyists & friends