You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Instantly share code, notes, and snippets.
🥊
Hit. Don't get hit.
Tim Uruski
timuruski
🥊
Hit. Don't get hit.
Developer, mostly Ruby, working for @tivocorp on TMDB.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Not sure if this is a good idea, but it seems to work okay.
This is a callback object for copying denormalized associations from
some sort of parent or key record into a child on initialize.
Consider this extremely simple multi-tenant blog application. We have
many sites, and each site has a list of users. For our super-admin
system we want some of these associations denormalized so
has_many_through isn't quite what we need.
CSV parser for working with malformed and mis-encoded CSV from a client.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Provide a ActiveModel::Validations style set of helpers for models to add input filters that work on all dirty fields before validation.
The point of this is I have a project that requires some data consistency and right now that's all ad-hoc and messy. I need a better way to quickly ensure that a username is lower case, things are trimmed properly before stored in the db, etc. Right now that's all done manually on the controller or model, or not at all.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
An example of how to mix in custom behaviour based on a basic parent-child relationship. This could easily work with some sort of mixins column in the database or anywhere else. The technique should be applied lightly, but provides a means to add some custom behaviour to outlier cases but keeping it contained.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Models, Roles, Decorators, and Interactions -- A modest proposal for a toned done version of DCI that isn't as janky as Concerns.
Models, Roles, Decorators, and Interactions
A modest alternative to DCI that might be worth further thought
One of the problems with advancing the discussion on DCI is that we lack a comparable alternative pattern that has the same goals, but favors a low ceremony approach. The closest thing we have to that is Rails concerns, but they are more like distant relatives of the DCI concepts rather than first cousins, and that makes comparisions between the two approaches not especially fruitful.
I am considering the idea of experimenting with my own paradigm that captures the intent and purity of DCI, but with the convenience of concerns. Please note that this is just the starting point of a conversation, it is NOT a promise of comercially available cold fusion or a cure for cancer. It's just a gist with an idea on it I'd like to hear your thoughts on.
What if we had a top-level topology that was split into Models, **Rol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters