title: Rails and Rake task - How to call a Rails method inside a custom class defined in a rake task file
body: <p>I have the following code in <code>"Rails Root"/lib/tasks/example.rake</code>:</p>
  
  <pre><code>task :example_task =&gt; :environment do
    e = Example.new
    e.example_method
  end
  
  class Example
    def example_method
      select_tag 'Example'
    end
  end
  </code></pre>
  
  <p>When I call <code>e.example_method</code> in the rake task, I get the error <code>"undefined method 'select_tag' for #&lt;Example:0x39f58b0&gt;"</code>. </p>
  
  <p><code>select_tag</code> is a Rails method: <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-select_tag" rel="nofollow">http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#method-i-select_tag</a></p>
  
  <p>How do I make the <code>select_tag</code> call work?</p>