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 Rails Routes and Resources A Route to an Index Action Creating a Model

Daniel Bateman
Daniel Bateman
13,268 Points

Migration issue

Followed Jay's instructions, but when it came to migration I keep getting the following message:

rails aborted!
SyntaxError: c:/Rubyapps/blog/db/migrate/20181010214539_create_pages.rb:4: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
c:/Rubyapps/blog/db/migrate/20181010214539_create_pages.rb:5: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

Not sure what could be messing up the migration.

Thanks in advance

1 Answer

Jay McGavren
STAFF
Jay McGavren
Treehouse Teacher

This part of the output shows that there are errors in the code in your db/migrate/20181010214539_create_pages.rb file, on lines 4 and 5:

c:/Rubyapps/blog/db/migrate/20181010214539_create_pages.rb:4: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
c:/Rubyapps/blog/db/migrate/20181010214539_create_pages.rb:5: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'

If you can't find the error on your own, post the contents of your db/migrate/20181010214539_create_pages.rb file in a reply to this thread, and someone should be able to help you spot it. Be sure to refer to the "Markdown Cheatsheet" link to help you with formatting when posting the file contents.