Setup Rails

Ruby on Rails Development

Recommended editor: NetBeans. Other alternative: aptana.

Also see http://www.aptana.com/docs/index.php/Integrating_RadRails_with_Aptana#Aptana_M8a.2FEclipse_3.2.2FRails_plug-in_Instructions

Installing gems package manager locally

Also see http://ianloic.com/installing_ruby_gems_in_your_home_directory and https://help.ubuntu.com/community/RubyOnRails

export GEM_HOME=$HOME/lib/ruby/gems/1.8
export RUBYLIB=$HOME/lib/ruby:${HOME}/lib/site_ruby/1.8

Onthou om GEM_HOME en RUBYLIB in ~/.bashrc of ~/.profile te define. Sit ook /lib/ruby/gems/1.8/bin op die pad.

Download and unpack the Gems source from http://rubyforge.org. Run the setup.rb script with the right arguments to install into your home directory:

ruby setup.rb all --prefix=$HOME --siterubyver=$HOME/lib/site_ruby/1.8

This will install the gem command (and a couple of others) into $HOME/bin and the Gems source into $HOME/lib/site_ruby. Gems will be installed into $HOME/lib/ruby/gems/1.8. You should add $HOME/bin to your path. If you want to install it somewhere else replace $HOME with the prefix you'd like to use.

Install Rails itself

gem install rails --rdoc --ri --include-dependencies

Dependencies

mysql-server libmysql-ruby libopenssl-ruby

To check, create a ruby project:

rails demo

In the demo directory, do

script/about

To create database:

mysqladmin -u root create blah_development

To test database connection:

rake db:migrate

From http://fairleads.blogspot.com/2007/12/rails-20-and-scaffolding-step-by-step.html:

You can see that there are separate tables for development testing and production. This separation helps in the development and maintenance of Rails projects.

In a difference from earlier Rails versions, Rails 2.0 will create the databases needed with the command:
exchange$ rake db:create:all
(in /home/sean01/work/exchange)
exchange$

Also see http://www.ruby-forum.com/topic/134691

See http://activescaffold.com/

Overview of new 2.0 features and how to handle the new scaffolding: http://blog.sublogic.com/2007/12/rails-20-and-following-dhhs-build-a-blog-screencast/

Useful things to remember

./script/generate scaffold product title:string description:text image_url:string
rake db:create
rake db:create:all
rake db:migrate
rake test:units

Tampering with cookies

If you see

CGI::Session::CookieStore::TamperedWithCookie

then you need to clear the browser cookie cache.

MySQL tips

Use 'desc table' to view fields.


sub-sahara africa
subrahaman
sahara trip IanKnot rainbow