---
title: Avoid fat models
impact: HIGH
impactDescription: Prevent models from becoming monolithic and hard to maintain.
tags: rails, architecture, models, mvc
---

## Avoid fat models

Prevent models from becoming monolithic and hard to maintain. Keep models focused on associations, validations, and simple domain logic. Extract complex workflows or unrelated concerns into service objects or specific classes.

**Incorrect:**

```ruby
# User model handling too many things (auth, analytics, profile, etc.)
class User < ApplicationRecord
  def generate_analytics_report
    # complex logic unrelated to core User state
  end
  
  def process_subscription_upgrade
    # complex workflow
  end
end
```

**Correct:**

```ruby
class User < ApplicationRecord
  # core logic only
end

class AnalyticsReportGenerator
  def self.call(user)
    # complex logic
  end
end
```

**Tools:** RuboCop (`Metrics/ClassLength`)
