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 Build a Rails API Namespacing Routes and JSON Namespaces and Routes

Gene Johnson
Gene Johnson
3,471 Points

I get the following error when I attempt to visit localhost:3000/api/todo_lists.json

Missing secret_key_base for 'development' environment, set this value in config/secrets.yml

Is this due to versioning or configuration/an outdated video?

Also, why does the video not continue the previous one?

1 Answer

Was having the same issue, but this fixed it. Found this in another thread - just reposting here for anyone else with this issue:

  1. Create a secrets.yml file in your config directory.
  2. In your terminal, type the following command: rake secret. This will generate a secret for you to include in your secrets.yml file.
  3. Add the following snippet of code to your config/secrets.yml file:
development:
  secret_key_base: PASTE_YOUR_GENERATED_SECRET_HERE

(NOTE: WHEN TYPING THE ABOVE COMMAND, BE SURE TO ADD SPACES BEFORE "secret_key_base" AND NOT TABS, AS THIS WON'T WORK IN A YML FILE.)

Be sure to migrate your database: bin/rake db:migrate RAILS_ENV=development

Now when you boot up the server and render the application in the browser, you should be good to go.