Tag Archives: ruby

rails console 出错 (ubuntu10.04) 记录

在Ubuntu10.04下学习rails,在rails c的时候出错。 提示如下: /home/yoxyue/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `require’: no such file to load — readline (LoadError) from /home/yoxyue/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/irb/completion.rb:9:in `<top (required)>’ from /home/yoxyue/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `require’ from /home/yoxyue/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands/console.rb:3:in `<top (required)>’ from /home/yoxyue/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:38:in `require’ from /home/yoxyue/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.2.1/lib/rails/commands.rb:38:in `<top (required)>’ from script/rails:6:in `require’ from script/rails:6:in `<main>’ 解决办法如下: $sudo apt-get install libreadline6-dev $which ruby /home/yoxyue/.rvm/rubies/ruby-1.9.2-p290/bin/ruby $cd /home/yoxyue/.rvm/src/ruby-1.9.2-p290/ext/readline $ruby extconf.rb $make $make install 再次在项目目录下 rails c 成功!

Posted in 编程开发 | Tagged , , | Leave a comment

如何在windows下安装ruby 1.9.3+rails 3.1.3+Mysql及配置

大牛都在Mac和Linux上做开发。我等菜鸟纠结于各种原因只能蹲在windows下,最近因为工作需要,为自己搭建了一个ruby on rails的开发环境。一边学习一边进步吧。同时适用于1.9.2-p290 开始: 现在工作用的是win7,家里是xp,都可以通过。 第一步:所需要各种包 1.ruby 1.9.3 安装包 http://rubyforge.org/frs/download.php/75465/rubyinstaller-1.9.3-p0.exe 我建议还是装1.9.2比较好。 2.rubygems 1.8.5,以后各种包的下载就需要用gem来做。 下载,解压缩,进入目录,  ruby setup.rb 回车。 http://rubyforge.org/frs/download.php/75710/rubygems-1.8.15.zip 3.安装DevKit ruby dk.rb init ruby dk.rb install 4.如果要使用mysql数据库 copy libmysql.dll to /ruby/bin/ 文件名:libmysql.zip,访问地址:http://www.kuaipan.cn/index.php?ac=file&oid=25186933764260645 gem install mysql2 然后 在项目的Gemfile里面 gem ‘mysql2′ 5. 更新源 gem update –system 6.gem install rails 7. rails new 项目名 8. rails s  启动项目然后访问 http://localhost:3000来访问。 现在安装应该成功了. PS:我已经改用1.9.2了(2012/02/12) 如果存在YAML的问题请参照:修改config/boot.rb If you cannot (or don’t want to) fix your YAML code, try to load the old YAML parser (syck), adding this at the … Continue reading

Posted in 编程开发 | Tagged , | Leave a comment