A concern about rails validators, breaking MVC in complex projects

What's wrong with something like this:

class SomeModel
  attr_accessor :validate_the_thingy

  validate :make_one_particular_and_unique_thingy_go_red, :if => :validate_the_thingy

in the controller:

@some_model = SomeModel.some_factory_method(params)
@some_model.validate_the_thingy = true

In both cases, the validation method is sitting around on the model.

I'd argue that this "breaks MVC" *less* than the solution in your Gist, since this keeps the flag separate from its implementation, rather than having the controller poke extra validations (by method name) directly into the model instance.

If you've *really* got bunches of wildly divergent validation setups, I'd agree with the suggestion on the ticket to actually create a (plain Ruby) mediator object and use the ActiveModel APIs.

--Matt Jones