New rails edge project - step by step

I am trying to create a new rails project in edge:

rails campus
cd campus
rake rails:freeze:edge
script/generate model topic title:string body:text
rake db:create:all
rake db:migrate
script/generate controller topics index new create
rm public/index.html

I added this line to routes.rb:
map.root :controller => “topics”

I type http://localhost:3000 and get this message:
Status: 500 Internal Server Error Content-Type: text/html
In the development.log I see this:
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” } in config/
environment.rb

what am I doing wrong?

If I recall correctly, that line is initially commented out. Just edit
the config/environment.rb and remove the # in the front of that line.

That should work for you
CW

oren wrote:

I am trying to create a new rails project in edge:

rails campus
cd campus
rake rails:freeze:edge
script/generate model topic title:string body:text
rake db:create:all
rake db:migrate
script/generate controller topics index new create
rm public/index.html

I added this line to routes.rb:
map.root :controller => “topics”

I type http://localhost:3000 and get this message:
Status: 500 Internal Server Error Content-Type: text/html
In the development.log I see this:
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” } in config/
environment.rb

what am I doing wrong?

Hi Oren :

what am I doing wrong?

Since it’s a new Rails project, I would use the edge rails command
to create all the skeleton of the app, with the new shiny config/boot.rb
the config/initializers dir and so on… and let it create the secret
phrase
for me.

rails campus_tmp
cd campus_tmp
rake rails:freeze:edge
cd …
ruby campus_tmp/vendor/rails/railties/bin/rails campus
mv campus_tmp/vendor/rails campus/vendor/rails
rm -Rfv campus_tmp
cd campus
script/generate model …

and so on

And in config/environment.rb you will have a correct
hash for config.action_controller.session, since Rails
generates it for you.

– Jean-François.

great, it works!

I would like to understand what i just did…

ruby campus_tmp/vendor/rails/railties/bin/rails campus #what’s going
on
here?
mv campus_tmp/vendor/rails campus/vendor/rails #and here?
rm -Rfv campus_tmp

where can I learn about the edge/rails 2.0? (I am new to rails, just
read
DHH’s book).

thanks!

Oren :

great, it works!

I would like to understand what i just did…

ruby campus_tmp/vendor/rails/railties/bin/rails campus
#what’s going on here?

We’re using the edge version of rails command to
generate the campus project, instead of using a 1.2.* version
of rails command. So you’re sure that the files are up to
date with your version (edge) of Rails. And the Rails generator
will provide a secret phrase for you in config/environment.rb,
so you don’t need to create one manually.

mv campus_tmp/vendor/rails campus/vendor/rails #and here?

Well with the previous invocation of rails:freeze:edge task,
you’ve downloaded the edge rails source, there’s no use
to download it twice, so we’ve just moved now in the right
place, in the campus project structure.

rm -Rfv campus_tmp

We can now remove the temporary campus_tmp project.

where can I learn about the edge/rails 2.0? (I am new to rails,
just read DHH’s book).

I’m afraid that Rails edge doesn’t fit to beginners, since
you must have a good knowledge of Rails and Rails internals,
to be able to debug on your own.

– Jean-François.