Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby ActiveRecord Basics AR Extensions Sample Data / Indexes

Tarek El Hinaoui
PLUS
Tarek El Hinaoui
Courses Plus Student 13,220 Points

Rake Fake task error..

I built the fake.rake task this is the code

 task :fake => :environment  do

        Customer.create (name: Faker::Company.name,
                         city: Faker::Address.city,
                         zipcode: Faker::Address.zip.to_i,
                         state: Faker::Address.state_abbr,
                         email: Faker::Internet.email,
                         employees: (rand * 100).to_i)
    end

    end

But when i run it i get the following error rake fake DL is deprecated, please use Fiddle rake aborted! SyntaxError: C:/Users/Tarek/treehouse/projects/biller/lib/tasks/fake.rake:3: syntax error, unexpected tLABEL Customer.create (name: Faker::Company.name, ^ C:/Users/Tarek/treehouse/projects/biller/lib/tasks/fake.rake:4: syntax error, unexpected tLABEL, expecting '=' city: Faker::Address.city, ^ C:/Users/Tarek/treehouse/projects/biller/lib/tasks/fake.rake:5: syntax error, unexpected tLABEL, expecting '=' zipcode: Faker::Address.zip.to_i, ^ C:/Users/Tarek/treehouse/projects/biller/lib/tasks/fake.rake:6: syntax error, unexpected tLABEL, expecting '=' state: Faker::Address.state_abbr, ^ C:/Users/Tarek/treehouse/projects/biller/lib/tasks/fake.rake:7: syntax error, unexpected tLABEL, expecting '=' email: Faker::Internet.email, ^ C:/Users/Tarek/treehouse/projects/biller/lib/tasks/fake.rake:8: syntax error, unexpected tLABEL, expecting '=' employees: (rand * 100).to_i) ^ C:/Users/Tarek/treehouse/projects/biller/lib/tasks/fake.rake:8: syntax error, unexpected ')', expecting keyword_end employees: (rand * 100).to_i) ^ C:/Users/Tarek/treehouse/projects/biller/Rakefile:6:in `<top (required)>' (See full trace by running task with --trace)

Tarek El Hinaoui
Tarek El Hinaoui
Courses Plus Student 13,220 Points

SOLVED I had to remove the spacing, (name: Faker::Company.name) to (name:Faker::Company.name) it appears that the 1.9+ parser converts the space to a symbol whereas the 1.8 parser did not.

1 Answer

Tarek El Hinaoui
PLUS
Tarek El Hinaoui
Courses Plus Student 13,220 Points

SOLVED I had to remove the spacing, (name: Faker::Company.name) to (name:Faker::Company.name) it appears that the 1.9+ parser converts the space to a symbol whereas the 1.8 parser did not.