title: rails custom validation for array returning undefined method error
body: <p>I am writing a custom validation method for an attribute in a model called Project.  Here is my code:</p>
  
  <pre><code>def self.skill_options
    categories = Craft.all.collect{|craft| craft.label} #should change this later
    return categories
  end
  
  validate :validate_tag_list
  
  def validate_tag_list
    puts skill_options.inspect.to_s
    puts 'validate tag list is happening'
    self.tag_list.each do |tag|
      if self.skill_options.include?(tag)
        puts tag.to_s + 'is included yo'
      else
            puts tag.to_s + 'not included yo'
            self.errors.add(:tag_list, "#{tag} is not a valid skill.")
      end
    end
  end
  </code></pre>
  
  <p>For some reason, I am being told:</p>
  
  <pre><code>NameError (undefined local variable or method `skill_options' for #&lt;Project:0x007fb6fc02ac28&gt;)
  </code></pre>
  
  <p>I am not sure why this is.   I have another validation in the same model for a different attribute called category.  This validation works perfectly.  Here is the code:</p>
  
  <pre><code>def self.category_options
    categories = Craft.all.collect{|craft| craft.label} #should change this later
  end
  validates :category,  inclusion: {in: category_options}
  </code></pre>
  
  <p>The only difference is that the first validation (on skills) requires a custom validation because it is an array.</p>
  
  <p>How do I get rid of the error?</p>