title: Rails controller manually sanitize parameters
body: <p>Suppose my views need to pass some params that are absolutely not related to a model. What are the best ways to sanitize the input in the controller ?</p>
  
  <p>Eg
  - Validate inclusion of a parameter in a string array : <code>display_type</code> param that sets whether search results are displayed on a map or in a list, as cards, etc., but only a few are defined and available
  - Validate the type/numericality of some parameter (eg params[:page] should be an integer or fallback to default page 0</p>
  
  <p>Currently I'm using something like</p>
  
  <pre><code>def validate_xxx_param
    if ['map', 'card'].include?(params[:display_type))
      ...
    else
      ...
    end
  end
  </code></pre>
  
  <p>But is there a cleaner/better OOP way of doing that ?</p>