title: Access class methods from inclusion validation
body: <p>I would like to include a class method as my options when using the inclusion validation:</p>
  
  <pre><code>class Search &lt; ActiveRecord::Base
  
    attribute :foo, Array
    validates :foo, inclusion: class_method_options
  
    def self.class_method_options
     ['foo', 'bar']
    end
  end
  </code></pre>
  
  <p>However I get <code>undefined method 'class_method_options' for Search:Class (NoMethodError)</code>.</p>
  
  <p>I tried Googling for the solution, but just found how to create a custom validation. I don't need a whole new validation, I just want to use the standard Rails inclusion validator. How can I access <code>class_method_options</code> from the inclusion validation?</p>