title: Rails validation of non-models
body: <p>I was just wondering what the recommended approach would be for validating a form that is <strong>not</strong> based on a model. I agree that generally all validation should be done in models but there are situations where a particular form might not have a corresponding model(s). For example, an arbitrary search form.</p>
  
  <p>Based on my current research, there are two main ways of doing it as far as I can see,</p>
  
  <ol>
  <li>Validate in the controller.
  <ul>
  <li>Is it possible to utilise the Rails validations in the controller? I really would prefer to use them over my own custom code.
  <br/><br/></li>
  </ul></li>
  <li>Create an arbitrary class eg. called <code>SearchForm</code> and include the <code>ActiveRecord::Validations</code>
  <ul>
  <li>Should the class be stored with the models (even though it isn't really)?</li>
  <li>The posts that recommended this approach indicated you have to stub out a bunch of methods for ActiveRecord such as save, save!, update_attribute, etc. This strikes me as not very Rubyesque at all!
  <br/><br/></li>
  </ul></li>
  <li>Any other suggestions?</li>
  </ol>