Thanks guys. I generated the secret string using rake secret and added the code to config/environment.rb and that error has now disappeared.
It seems the error came about because I started coding the app under Rails 1.2.6 and then upgraded to Rails 2.0.2 to be in line with the version used by the Simply Rails 2 book. As a newbie I don't fully understand what rake can be used for, but I'm sure I'll learn soon enough. Thanks again. On Jul 10, 2:02 am, Rick DeNatale <[email protected]> wrote: > On Thu, Jul 9, 2009 at 11:49 AM, shusseina<[email protected]> wrote: > > Viewinghttp://localhost:3000/storiesin my browser should display the > > file app/views/stories/index.html.erb, but instead displays the > > following error: > > > Status: 500 Internal Server Error Content-Type: text/html > > 500 Internal Server Error > > > Any ideas what might be causing this error? > ... > > Status: 500 Internal Server Error > > A secret is required to generate an integrity hash for cookie > > session data. Use config.action_controller.session = { :session_key => > > "_myapp_session", :secret => "some secret phrase of at least 30 > > characters" } in config/environment.rb > > Well, it's telling you how to fix it. You need to put something like > > config.action_controller.session = { > :session_key = "-myapp_session", # where myapp should be the > name of your application instead of myap > :secret => "Some Random String at least 30 characters long, > usually a long hexadecimal string" > } > > somewhere inside the intializer block (which begins with) > Rails::Initializer.run do |config| > > inside config/environment.rb > > You can and probably should use rake secret to generate the secret. > > -- > Rick DeNatale > > Blog:http://talklikeaduck.denhaven2.com/ > Twitter:http://twitter.com/RickDeNatale > WWR:http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn:http://www.linkedin.com/in/rickdenatale --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

