Made a gem out of an earlier proof-of-concept: https://github.com/henrik/activemodel-with_conditions
This lets you do things like
``` ruby
with_conditions(if: :feature_x_is_on?) do
validate :free_plans_must_have_x, if: :free_plan?
end
```
where the conditions merge intuitively, unlike `with_options`.
Qiita - 人気の記事