Why this matters
Improves cohesion, reuse, and testability.
Move domain behavior from controllers/views into models or service objects.
Improves cohesion, reuse, and testability.
Side-by-side examples engineers can pattern-match during review.
def create; total = params[:items].sum { |i| i[:p]*i[:q] }; ... enddef create; total = OrderCalculator.total(params[:items]); ... endcontroller computes totalsservice/model encapsulates logicFrom the same buckets as this rule.