开发者

Rails 3.0 Production Mode Error

I'm trying to put a rails 3.0 app in production mode. I'm hosting it on slicehost.com. I've set up ruby 1.8.7, updated my gems, installed rails 3.0, installed mysql, install passenger, and a blank rails app loads up. I've my yml file to connect to the db. I've even added RailsEnv production in my apache2 config (even though I'm told it defaults to production).

I then cd to my app run rake db:migrate RAILS_ENV=production and get the following error:

Could not find gem 'sqlite3'

Now, I am confused because I'm trying to create a production db in mysql, so why does it care about sqlite3.

It tells me to do a bundle install, but I could only guess this is going to set up a development db.

Any advice here.

I don't know what they did in rails 3.0, but this is really annoying.

I like how in 2.x you just add RAILS_ENV='production' in your environment file.

Any ways rant off.

I'd appreciate some help.

Thank you,

Brian

Update:

login as: root root@ password: Welcome to Ubuntu 11.04 (GNU/Linux 2.6.35.4-rscloud x86_64)

  • Documentation: https://help.ubuntu.com/ You have mail. Last login: Tue Aug 23 14:15:09 2011 from adsl-99-142-52-152.dsl.emhril.sbcglobal.net root@:~# dir public_html rvm-installer sources root@:~# cd public_html root@:~/public_html# cd ticket root@:~/public_html/ticket# rake db:migrate RAILS_ENV=production WARNING: This version of mysql2 (0.3.7) doesn't ship with the ActiveRecord adapter bundled anymore as it's now part of Rails 3.1 WARNING: Please use the 0.2.x releases if you plan on开发者_Go百科 using it in Rails <= 3.0.x rake aborted! !!! Missing the mysql2 gem. Add it to your Gemfile: gem 'mysql2'

Tasks: TOP => db:migrate (See full trace by running task with --trace) root@:~/public_html/ticket#


You can resolve this issue by using groups in your Gemfile.

Add sqlite to only to your test and development groups and in production run bundler as

bundle install --without test development

Sample Gemfile:

gem "mysql2", "~> 0.2.7
gem "passenger"

gem "sqlite3", :group => :development

Source: http://gembundler.com/groups.html

UPDATED: As of 0.3.0, and ActiveRecord 3.1 - the ActiveRecord adapter has been pulled out of mysql2 gem and into ActiveRecord itself. If you need to use mysql2 with Rails versions < 3.1 make sure and specify gem "mysql2", "~> 0.2.7" in your Gemfile

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜