title: Invoking Rake::Task in rails causes "Don't know how to build task..."
body: <p>Trying to integrate some friendly_id gem functionality on a controller method.</p>
  
  <p>Essentially, I have a Market object, which has its URL created based on a custom method.  Since it's based on a custom method, <a href="http://norman.github.com/friendly_id/file.Guide.html#using_a_custom_method_to_generate_the_slug_text" rel="nofollow">friendly_id</a> won't update the URL when the Market object gets updated.  Friendly_id does offer a redo_slugs rake task, but when I call it from within my controller, it tells me that it can't build the task.  Running the command outside works just fine.</p>
  
  <p>The code for my controller looks like this:</p>
  
  <pre><code>require 'rake'
  require 'friendly_id'
  
  class Admin::MarketsController &lt; ApplicationController
    def update
      if @market.update_attributes(params[:market])
        rake_market_slugs
      end
    end
  
    protected
      def rake_market_slugs
        Rake::Task["friendly_id:redo_slugs MODEL=Market"].invoke
      end
  end
  </code></pre>
  
  <p>Am I missing something? Or can I just not do this inside my controller?</p>
  
  <p>Thank you.</p>