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 Simple Ruby on Rails Application Creating an Authentication System Generating the User Model

Can't create user. "undefined local variable or method `config' for main:Object (NameError)"

I somehow can't get devise to create the user. I've checked and I am running the correct version of rails. Any suggestions? Thanks

/treebook/config/environments/development.rb:39:in <top (required)>': undefined local variable or methodconfig' for main:Object (NameError) from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in require' from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:inblock in require' from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:in load_dependency' from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:inrequire' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/engine.rb:576:in block in <class:Engine>' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/initializable.rb:30:ininstance_exec' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/initializable.rb:30:in run' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/initializable.rb:55:inblock in run_initializers' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/initializable.rb:54:in each' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/initializable.rb:54:inrun_initializers' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/application.rb:136:in initialize!' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/railtie/configurable.rb:30:inmethod_missing' from /home/max/Desktop/Ruby-Test/treebook/config/environment.rb:5:in <top (required)>' from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:inrequire' from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in block in require' from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:236:inload_dependency' from /var/lib/gems/2.1.0/gems/activesupport-3.2.18/lib/active_support/dependencies.rb:251:in require' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/application.rb:103:inrequire_environment!' from /var/lib/gems/2.1.0/gems/railties-3.2.18/lib/rails/commands.rb:25:in <top (required)>' from script/rails:6:inrequire' from script/rails:6:in `<main>'

2 Answers

Found the error. A few steps earlier I pastest some code wrong into the developement.rb. I Put the "config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }" before the "end". Now the issue is solved.

Treebook::Application.configure do # Settings specified here will take precedence over those in config/application.rb

# In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart the web server when you make code changes. config.cache_classes = false

# Log error messages when you accidentally call methods on nil. config.whiny_nils = true

# Show full error reports and disable caching config.consider_all_requests_local = true config.action_controller.perform_caching = false

# Don't care if the mailer can't send config.action_mailer.raise_delivery_errors = false

# Print deprecation notices to the Rails logger config.active_support.deprecation = :log

# Only use best-standards-support built into browsers config.action_dispatch.best_standards_support = :builtin

# Raise exception on mass assignment protection for Active Record models config.active_record.mass_assignment_sanitizer = :strict

# Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL) config.active_record.auto_explain_threshold_in_seconds = 0.5

# Do not compress assets config.assets.compress = false

# Expands the lines which load the assets config.assets.debug = true

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 } end

I've tried different versions of ruby and rails... Now running Ruby 1.9.3 and Rails 3.2.18 and still getting the same error.