Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.