我之前使用的是Ruby 1.8.7& Rails 2.3.5 on Heroku。
我使用说明this railscast将我的开发环境升级到Ruby 1.9.2和Rails 3.0.1。使用RVM,因此Ruby和Rails的系统版本仍然是1.8.7& Rails分别为2.3.5,但我有一个带有1.9.2和3.0.1的RVM环境,我现在使用它。
我现在正试图让新版本在Heroku上运行。我将Heroku stack切换到了bamboo-mri-1.9.2并且git push heroku master
。这似乎有效:
-----> Heroku receiving push
-----> Migrating from bamboo-ree-1.8.7 to bamboo-mri-1.9.2
-----> Rails app detected
-----> Detected Rails is not set to serve static_assets
Installing rails3_serve_static_assets... done
-----> Gemfile detected, running Bundler version 1.0.0
Unresolved dependencies detected; Installing...
Fetching source index for http://rubygems.org/
(gems installing here)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
Your bundle was installed to `.bundle/gems`
Compiled slug size is 5.9MB
-----> Launching.... done
http://www.(website url).com deployed to Heroku
-----> Migration complete, your app is now running on bamboo-mri-1.9.2
但后来我尝试heroku rake db:migrate
并得到了这个错误:
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.
(in /disk1/home/slugs/233596_aed03bf_79e9-a5a7f70e-7120-4f42-ad2a-162b4a1974d6/mnt)
出于某种原因,它仍然认为它在Rails 2.3.5上运行。是什么导致了这个问题?谢谢你的阅读。
的Gemfile
gem "rails", "3.0.1"
的.gitignore:
.bundle
log/*.log
tmp/*
tmp/**/*
doc/api
doc/app
db/*.sqlite3
*.swp
*~
.DS_Store
到config / environment.rb
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
Liferecord::Application.initialize!
配置/环境/ production.rb
my_app::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
# config.cache_store = :mem_cache_store
# Disable Rails's static asset server
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
编辑:
$ heroku info
=== (heroku name)
Web URL: (my url)
Domain name: (my domain)
Git Repo: git@heroku.com:(heroku name).git
Dynos: 1
Workers: 0
Repo size: 10M
Slug size: 388k
Stack: bamboo-mri-1.9.2
Data size: 416k in 9 tables
Addons: Custom Domains
Owner: (my email)
答案 0 :(得分:1)
我认为您需要更改本地计算机指向的堆栈。什么
> heroku info
告诉你终端?
也许这有助于http://docs.heroku.com/renaming-apps#manually-updating-a-git-remote。