ruby on rails - How to build task 'db:populate' -


  1 namespace: db 2 characters "fill database with sample video" 3 functions: populate = & gt; ; 4 for environment: 'Fakar' 5 rack :: Task ['DB: Reset'] is required. 7 Title = Faker :: Lorem.sentence (3) 8 videos = Faker :: Lorem.words (5) 9 Video.create! (Currently: headline = & gt; title, 10: video = & gt; video) 11 end 12 end 13 end   

I currently present this rack function lib / tasks / sample_data.rb < / P>

is running when rake db: populate I get an error, how the task should not be dubbed 'db: populate' How do I see it? ?

Note: I am a newbie in Rail / Ruby I am using Rail 3.

Sample_data. Try renaming the file in the fix.

You can work your example by putting your code into lib / tasks in a file named testomatic.rake (internal statement of work with AP statement).

Comments