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

Ruby on rails problem - We're sorry, but something went wrong (500) please help

Hi, I'm doing the lesson ruby on rails and am very new to it. I installed it from http://railsinstaller.org/ like advised. I run the console and have no problem. I can create dirs and start the server. I built the treebook application and then when I go to 127.0.0.1:3000 i get the "We're sorry, but something went wrong (500)" error. I looked in development logs and I see this -- ArgumentError (A secret is required to generate an integrity hash for cookie session data. Use config.secret_token = "some secret phrase of at least 30 characters"in config/initializers/secret_token.rb):

it goes on much longer but just posting this unless you need to post more. I'm on Windows 8 Pro with Norton 360 installed. Thank you so much for any help! Dave

8 Answers

James Barnett
James Barnett
39,199 Points

Try using this command on the command line: rake secret

Thank you! I got the random # now. But now when i run the server I get this:

You did not specify how you would like Rails to report deprecation notices for y our development environment, please set config.active_support.deprecation to :lo g at config/environments/development.rb SECURITY WARNING: No secret option provided to Rack::Session::Cookie. This poses a security threat. It is strongly recommended that you provide a secret to prevent exploits that may be possible from crafted cookies. This will not be supported in future versions of Rack, and future versions will even invalidate your existing user cookies.

    Called from: C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/action

pack-3.2.1/lib/action_dispatch/middleware/session/abstract_store.rb:28:in `initi alize'.

[2013-02-19 09:44:02] INFO WEBrick 1.3.1 [2013-02-19 09:44:02] INFO ruby 1.9.3 (2012-02-16) [i386-mingw32] [2013-02-19 09:44:02] INFO WEBrick::HTTPServer#start: pid=10908 port=3000

Thanks! Dave

I'm pretty confused and this is frustrating. Again, when I go to 127.0.0.1:3000 it gives me the same ArgumentError about security! Oh boy!

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hi David,

Can you zip up your treebook project and email it to help@teamtreehouse.com? That will help me to troubleshoot the error.

Thank you Jason! I sent it over to you.

Rob Adams
Rob Adams
3,079 Points

I'm getting the same error on Ubuntu 12.04. I know there are differences and I've been able to adapt to most of them (even the REALLY annoying failure of rails server to shut down using Ctrl-C), but I'm stuck on not being able to see the /statuses page.

http://127.0.0.1:3000 looks fine, http://127.0.0.1:3000/statuses gives me a "We're sorry, but something went wrong." error page, which after a little digging is in the 500.html page. I get the same error when I click on the "About your application's environment" link on the main "Welcome Aboard" page.

When I run "rake secret", as suggested above, I get bunch of Gem deprecation notices: "NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01. Gem.source_index called from /home/parallels/Projects/treebook/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21. NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01. Gem::SourceIndex#initialize called from /home/parallels/Projects/treebook/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100. NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01. Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91. NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01. Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91. NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01. Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91. NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01. Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91. NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01. Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91. NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01. Gem::SourceIndex#add_spec called from /usr/lib/ruby/vendor_ruby/1.8/rubygems/source_index.rb:91. WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead. at /usr/lib/ruby/vendor_ruby/rake/rdoctask.rb Please install RDoc 2.4.2+ to generate documentation. 2bccc3f5a5e5b72771ec98297089e35dc83e88f86010666f3af27a383697eaee27a2c23c8d914af3c2ddfd0ec07a3f68c0170af6332cac2845ee1685559809c1"

I suspect I am missing an update to gems, but apt-get tells me I have the latest update. I had to jump through a bunch of hoops to get RVM to install, but at last it did without errors.

Any help would be greatly appreciated!

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey Rob,

The versions of Ruby and gems that Ubuntu uses are generally waaaay out of date. You'll need to install them with rvm and modify your path to use rvm instead. You can also uninstall the system Ruby libraries. It's a bit of a pain. Once you do all that then run bundle install again to get the latest versions.

Rob Adams
Rob Adams
3,079 Points

Jason thanks very much!

I basically removed all the ruby, rvm, gem and rails packages with apt-get, then went to the rvm.io site, loaded it with their instructions, then loaded rubygems and rails, rebuilt the project (which incidentally allowed me to use "rails new treebook" to build it rather than "rails treebook" as well as "rails server" rather than "script/server" and "script generate"

I was seriously about to jettison Ubuntu and load a different distro!