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 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.