2 ms·
>>In the example app you used, the models actually look pretty light on lines of code. I'm willing to bet the Views were full of conditionals, which is another
by enraged_camel 12y ago
>>In the example app you used, the models actually look pretty light on lines of code. I'm willing to bet the Views were full of conditionals, which is another thing I keep an eye out for.
I'm a Rails newbie so please excuse my ignorance... What is the connection between models being light on code and views being full of conditionals? What I assume you mean is that your models should also have view logic so that your templates aren't full of if-then statements. But isn't that what decorators are for?
- rubiquity 12y agoNo, the models shouldn't have view logic such as formatting, that belongs in Presenters. What I was implying is that the views likely have boolean logic/conditionals that are checking various states of the model and then rendering partials/HTML content based on that. Of course, there could also be model logic in the controllers and helpers as well.