title: How to build task 'db:populate'
body: <pre><code>  1 namespace :db do
    2   desc "Fill database with sample videos"
    3   task :populate =&gt; :environment do
    4     require 'faker'
    5     Rake::Task['db:reset'].invoke
    6     100.times do |n|
    7       headline = Faker::Lorem.sentence(3)
    8       video = Faker::Lorem.words(5)
    9       Video.create!(:headline =&gt; headline,
   10                   :video =&gt; video)
   11     end
   12   end
   13 end
  </code></pre>
  
  <p>I currently have this rake task in lib/tasks/sample_data.rb</p>
  
  <p>When running <code>rake db:populate</code> I get the error, <code>Don't know how to build task 'db:populate'</code>. How do I get around this?</p>
  
  <p>Notes:
  I am a newbie in Rails/Ruby. I am using Rails 3.</p>