第一个rails

   学了点ruby的初级语言基础,就等不及了要rails,我知道这也许是会错误的。不过,我对我这第一个程序来就很高兴了。我查了不少资料才上的,过程有点笨,不过,我是初学的。希望大家以鼓励的眼光看我,谢谢。
    第一步,C:\ruby>rails text
   第二步,C:\ruby\text>ruby script/generate controller catalog index
   第三步,C:\ruby\text>ruby script/server
      出现错误:no such file to load -- sqlite3,查了一下子的网,下ruby-1.8.6默认数据库不是mysql,后来下了个mysql6.0,装上后,把mysql里的bin\libmySQL.dll放到C:\ruby\bin下.
   第四步,重新建立app,C:\ruby>rails -d mysql text,提示一律输入y通过;
   (5), C:\ruby>rails text
        C:\ruby\text>ruby script/generate controller catalog index
   (6),验证数据库,C:\ruby\text>rake db:create:all
    出现Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8", "username"
=>"root", "adapter"=>"mysql", "host"=>"localhost", "password"=>nil, "database"=>
"text_development", "pool"=>5}, charset: utf8, collation: utf8_general_ci (if yo
u set the charset manually, make sure you have a matching collation)
Couldn't create database for {"reconnect"=>false, "encoding"=>"utf8", "username"
=>"root", "adapter"=>"mysql", "host"=>"localhost", "password"=>nil, "database"=>...}
c:/ruby/bin/rake:19: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-mswin32]
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

    8),进入database.yml,输入安装mysql的密码,注意格式password: 123.
    9),输入C:\ruby\text>rake db:create:all,有
text_development already exists
text_production already exists
text_test already exists

    10),输入C:\ruby\text>ruby script/server,打开IE,输入http://localhost:3000/catalog/index
    完成,终于提示没错误了。哈,过程有点笨。 :)

你可能感兴趣的:(C++,c,mysql,Ruby,Rails)