To set up a ROR development environment in Windows 7 and test it by creating an application called blog using mysql for your database, perform the following steps exactly as outlined below:
Download and install rubyinstaller-1.9.2-p0.exe from http://rubyforge.org/frs/?group_id=167.
I installed mine to the default location (c:\ruby192).
I also checked both check boxes about system path and associating files to ruby.
You do not need to install rubygems separately. It is included in rubyinstaller-1.9.2-p0.exe.
If you do install it separately, the below steps will not work. The only file you
need to download and install is rubyinstaller-1.9.2-p0.exe. (Trust me.)
Open command prompt
Perform the below Run commands in your command prompt (do not type Run: or # comment... of course)
Run: gem install rails # rails will install...takes a couple of minutes
Run: gem install mysql # installs the mysql2 gem
Open another command prompt
Run: rails server # wait for server to start
Open browser and open localhost:3000 in url field # checks that server works with Riding On Rails Page opening
Run: cd 'to_where_ever_you_want_to_install_your_application' # where you want to create your blog application in next step
Run: rails new blog -database=mysql # creates application named blog
Run: cd blog # changes directory to your new application named blog
open blog\config\database.yml in your text editor and correct mysql2 usernames and passwords if necessary and save file
Run: rake db:create:all # creates all databases
Run: rake db:migrate # checks database connection...ok if no complaint by rails
Run: rails generate model Article # open blog\db\migrate###...###_create_articles.rb and make changes as follows and save file:
class CreateArticles < ActiveRecord::Migration
create_table :articles do |t|
t.string :title # add this line
t.text :body # add this line
t.datetime :published_at # add this line
Run: rake db:migrate # creates articles table in blog_development database as per previous step