将Rails应用程序部署到不使用数据库的Heroku

时间:2022-05-24 20:38:42

I have a Rails app that uses Firebase for data storage. I've removed the require 'rails/all' and replaced it with:

我有一个使用Firebase进行数据存储的Rails应用程序。我删除了'rails / all'并将其替换为:

    require "action_controller/railtie"
    require "action_mailer/railtie"
    require "sprockets/railtie"

I deleted database.yml.

我删除了database.yml。

When I push to Heroku, it assumes a Postgresql database:

当我推送到Heroku时,它假设一个Postgresql数据库:

2014-06-23T17:42:04.122887+00:00 app[web.1]: Gem::LoadError (Specified 'postgresql' for database adapter, but the gem is not loaded. Add `gem 'pg'` to your Gemfile.):

Is there something I didn't do that would discourage Heroku from assuming a default database?

有没有我不这样做会阻止Heroku假设默认数据库?

Thanks!

1 个解决方案

#1


0  

The answer turned out to be that the Gemfile needed to be altered just to include the parts of Rails I need:

答案结果是需要改变Gemfile只是为了包含我需要的Rails部分:

# gem 'rails', '4.0.0'
gem 'actionpack'
gem 'activesupport'

Evidently, Heroku looks at the Gemfile and determines that and ActiveRecord dependency requires a database and ActiveRecord is a dependency by default.

显然,Heroku查看Gemfile并确定ActiveRecord依赖项需要数据库,默认情况下ActiveRecord是依赖项。

#1


0  

The answer turned out to be that the Gemfile needed to be altered just to include the parts of Rails I need:

答案结果是需要改变Gemfile只是为了包含我需要的Rails部分:

# gem 'rails', '4.0.0'
gem 'actionpack'
gem 'activesupport'

Evidently, Heroku looks at the Gemfile and determines that and ActiveRecord dependency requires a database and ActiveRecord is a dependency by default.

显然,Heroku查看Gemfile并确定ActiveRecord依赖项需要数据库,默认情况下ActiveRecord是依赖项。