Performance: Conditional validations
MEDIUM IMPACT
Conditional validations affect server-side processing time and can indirectly impact user experience by delaying response time.
validates :email, presence: true, if: :simple_flag?validates :email, presence: true, if: -> { complex_method_call_that_queries_database }| Pattern | Server Processing | Database Queries | Response Delay | Verdict |
|---|---|---|---|---|
| Complex condition with DB query | High | Multiple per validation | Noticeable delay | [X] Bad |
| Simple boolean flag condition | Low | None | Minimal delay | [OK] Good |