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 trialThomas Miller
6,039 PointsI'm getting the NoMethodError in Posts#index message as well.
In Jay's answer to the most recent question, he said to generate a migration. In the console, would that go:
bin/rails generate scaffold Post body:string
1 Answer
Harsh Mankad
4,650 PointsI think the code is: config --> routes.rb file: get '/pages', to: 'pages#index'
Then on console: bin/rails generate controller Pages
Then after you create the index method and generate a model it is:
bin/rails db:migrate . (which is what migrates the data to the database)
I hope this is helpful.
You can also try:
bin/rails generate migration AddBodyToPosts body:text