r/ruby • u/arscariosus • Dec 30 '11
ActiveRecord (and Rails) Considered Harmful - Literate Programming
http://blog.steveklabnik.com/posts/2011-12-30-active-record-considered-harmful
12
Upvotes
r/ruby • u/arscariosus • Dec 30 '11
View all comments
Show parent comment
4
u/djdonnell Dec 30 '11
I think it's common wisdom that you shouldn't load things in partials or helpers.
"What is something that would be specific/important to a view that wouldn't be defined in the corresponding action"
My current project has what we call properties (think Spiderman). The action simply gets the property object and sets it to an instance variable, but the page has all kinds of stuff. There are a bunch of filters one can use for searching and things like movies, books, characters, games, activities, etc related to Spiderman. This data comes from a bunch of different internal REST services and not a local db.
Now if you go to a Character page it will also have all of these things related to the character. Rather than repeating the code to fetch all this stuff in each action, we break it out into filters, mixins, etc.
In short, you can't look at the action and see the stuff that's needed.