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

Jed Bradshaw
Jed Bradshaw
6,053 Points

Error Code trying to Migrate

I had to uninstall Rails 4.0 and install 3.2.13. Now I think I have everything up and running Rails-wise correctly. However, when I try to start a server, the command console just spits out the 'Usage' directory and when I try to migrate, I get this error:

c:\Sites\treebook>rake db:migrate rake aborted! cannot load such file -- active_model c:/Sites/treebook/config/application.rb:3:in require' c:/Sites/treebook/config/application.rb:3:in' c:/Sites/treebook/Rakefile:4:in `' (See full trace by running task with --trace)

2 Answers

Stone Preston
Stone Preston
42,016 Points

did you only uninstall the rails gem? There may be other rails related gems left over. I recommend doing another uninstall using this

$ gem uninstall rails
$ gem uninstall railties

If you didnt uninstall railties the first time you uninstalled then that could be what is causing your error

Jed Bradshaw
Jed Bradshaw
6,053 Points

Thanks your suggestion. Yes I did do that. Also, I tried 'gem clean'. Do you have any other ideas?! :) I am trying it again though, just to be sure.

Stone Preston
Stone Preston
42,016 Points

hmm try uninstalling everything again using the commands I listed above, and also uninstall the active model gem ( it may be just be a part of the active record gem im not really sure you might have to do some googling?) as well. It sounds like maybe you have some gem versions mixed in together with rails 4 and rails 3.2 gems. I would have thought uninstalling rail ties would have fixed it, but it might not have.

Jed Bradshaw
Jed Bradshaw
6,053 Points

Ok, I did that. Now I have uninstalled and reninstalled and cleaned and messed with the active record gem and still nothing. And now I get this error when trying to start a server: c:\Sites\treebook>rails s C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2.13/lib/actio n_dispatch.rb:34:in `require': cannot load such file -- active_model (LoadError)

    from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionpack-3.2

.13/lib/action_dispatch.rb:34:in <top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands/server.rb:3:inrequire' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands/server.rb:3:in <top (required)>' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:49:inrequire' from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.1 3/lib/rails/commands.rb:49:in <top (required)>' from bin/rails:4:inrequire' from bin/rails:4:in `<main>'

Ugh this is driving me crazy! Thanks for the help!

Jed Bradshaw
Jed Bradshaw
6,053 Points

What I have done so far is remove all gems completely using this solution: http://shanky.org/2010/09/02/painlessly-remove-all-ruby-gems-on-windows/ and now I am re-installing Rails 3.2.13. I might just restart the entire tutorial. I will update this post to let everyone know how it goes.

Edit: Yes, apparently that was the problem. I don't know what I did but re-installing rails (gem install rails -v 3.2.13) seemed to fix the problem. After that, I redid this tutorial: http://teamtreehouse.com/library/programming/build-a-simple-ruby-on-rails-application/getting-started-with-rails/generate-a-rails-application and started a new app.

I still can't get my original one to work, but I'm ok with starting over. Practice makes perfect. If anyone wants to view my original failed treebook files I have them in a Dropbox link. Hopefully this will serve as a lesson to beginners for now: either don't use Rails Installer, or uninstall everything as soon as possible and then re-install 3.2.13 before starting your new adventure/app. Rails Installer will install Rails 4.0.0.rc2, and then you will run into all sorts of problems, and you may have to start over.

Original Post: https://teamtreehouse.com/forum/undefined-local-variable-for-or-method-config-for-mainobject-creating-an-authentication-system