Search code examples
ruby-on-railsrubyterminalsyntax-errorrake

rake db:seed yields syntax error, unexpected '\n', expecting =>


When I enter rake db:seed in terminal, I receive:

SyntaxError: /Users/-/src/-/db/seeds.rb:17: syntax error, unexpected '\n', expecting =>

Tasks: TOP => db:seed

...where db/seeds.rb has:

Category.create(kind: 'Food/Drink')        #line 9, everything above is commented out
Category.create(kind: 'Entertainment') 
Category.create(kind: 'Organization')
Category.create(kind: 'Business')
Category.create(kind: 'Collegiate')

Location.create(area: 'Downtown NB') 
Location.create(area: 'College Ave', 
Location.create(area: 'Cook/Douglass')     #line 17
Location.create(area: 'Livingston') 
Location.create(area: 'Busch') 
Location.create(area: 'Surrounding NB')
Location.create(area: 'Out of Town')

A --trace shows:

rake db:seed --trace

** Invoke db:seed (first_time)

** Execute db:seed

** Invoke db:abort_if_pending_migrations (first_time)

** Invoke environment (first_time)

** Execute environment

** Execute db:abort_if_pending_migrations

rake aborted!

SyntaxError: /Users/EuphoriaComplex/src/venture/venture/db/seeds.rb:17: syntax error, unexpected '\n', expecting =>


Solution

  • You have a typo on line 16th:

    Location.create(area: 'College Ave',
    

    should be

    Location.create(area: 'College Ave')