第一个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
    完成,终于提示没错误了。哈,过程有点笨。 :)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值