且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在rails上创建新的应用程序ruby

更新时间:2023-09-21 12:11:34

运行 rails新应用程序-d mysql 自动将所需的gem添加到您的Gemfile中,因此您不需要使用 gem 命令手动安装它们。尝试以下操作:

  $ rails新应用程序-d mysql 
$ cd app
$ bundle install
$ rake db:创建

我怀疑你正在遵循的教程是针对旧版本的的Rails。使用rails 3,您应该使用 bundler 进行所有宝石管理。


I'm bit confused by "easy" working with ruby on rails, cause I already spend three days by trying create an app.

I work on site5 hosting, and try to create new app. step by step:

$ rails new app -d mysql

$ gem install mysql

$ gem install mysql2

and after

$ rake db:create

it report about error

Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile.

I google it, but still can't fix problem. Can anybody help?

Running rails new app -d mysql will automatically add the required gems to your Gemfile, so you shouldn't need to install them manually with the gem command. Try the following:

$ rails new app -d mysql
$ cd app
$ bundle install
$ rake db:create

I suspect the tutorial you're following is for an older version of Rails. With rails 3, you should be using bundler for all gem management.