Reputation: 9891
I am writing a view where there is some logic involved. I could put these in a model or controller. But my question is, is it a bad practice leaving this much of logic in the view? (ruby code) Please see my code here
Upvotes: 0
Views: 186
Reputation: 5209
YEs, you should put minimum code on view and maximum code in model
I love this philosophy of skinny controllers and fat models : http://weblog.jamisbuck.org/2006/10/18/skinny-controller-fat-model
Upvotes: 3
Reputation: 35350
Yes, it's bad practice. Something like
TestFieldDefinition.find_all_by_company_id(...)
is business logic; it belongs in the Controller, not a View. The same goes for the majority of that pastie; that much conditional logic with no rendering of content is business logic and should be moved to the controller.
Upvotes: 2