- 1y ·
-
Public·
-
mastodon.social
If I could wave a magic wand and change one thing about Rails:
If I could wave a magic wand and change one thing about Rails:
@nateberkopec (I had to sneak a look at Xitter to see what you were talking about)
I wonder if you could override view_assigns in your controller and just call `strict_loading` on any ActiveRecord objects to enforce this
@nateberkopec never having to hear from DHH or 37Signals employees ever again.
@nateberkopec Yeet DHH into the sun.
@nateberkopec it’d be a coin flip between implicit instance variable passing to views, and removing Active Record and replacing it with something repository pattern based instead.
I read the replies and also agree with the DHH yeeting.
@nateberkopec (pretending you intended to ask) unless I specifically ask for a detached copy, there is only one shared in-memory instance of each model. Subsequent fetches get references to the existing (possibly dirty) instance, unless you explicitly reload with db contents
@nateberkopec I don’t know why, but controllers bother me a lot. Redesign them to be reasonably instantiatable, testable, get rid of hooks, no controller ivar sharing with views, really think about improvements to a lot of patterns that have emerged
@nateberkopec having tests and views next to the controller