Ruby on rails Ubuntu 14.04上的Heroku
我目前正在学习MichaelHartl的“RubyonRails教程”。在第3章中,当我尝试使用Heroku部署工作示例应用程序时,它被拒绝,即使我完全理解错误消息,我也不知道如何更正它。这是我的档案:Ruby on rails Ubuntu 14.04上的Heroku,ruby-on-rails,ruby,heroku,gem,ubuntu-14.04,Ruby On Rails,Ruby,Heroku,Gem,Ubuntu 14.04,我目前正在学习MichaelHartl的“RubyonRails教程”。在第3章中,当我尝试使用Heroku部署工作示例应用程序时,它被拒绝,即使我完全理解错误消息,我也不知道如何更正它。这是我的档案: source 'https://rubygems.org' ruby '2.0.0' #ruby-gemset=railstutorial_rails_4_0 gem 'rails', '4.0.5' group :development, :test do gem 'sqlite3',
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=railstutorial_rails_4_0
gem 'rails', '4.0.5'
group :development, :test do
gem 'sqlite3', '1.3.8'
gem 'rspec-rails', '2.13.1'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
end
gem 'sass-rails', '4.0.1'
gem 'uglifier', '2.1.1'
gem 'coffee-rails', '4.0.1'
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.1.1'
gem 'jbuilder', '1.0.2'
group :doc do
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
这是问题产生的文件,它是config/environments/development.rb:
SampleApp::Application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
我遇到的错误是尝试“git push heroku master”:
Running: rake assets:precompile
rake aborted!
NoMethodError: undefined method `configure' for #<SampleApp::Application:0x007fc7f03f7298>
你知道怎么解决这个问题吗?我真的很想让部署在Ubuntu下工作
谢谢大家! 默认情况下,Rails 4不会为您的资产提供服务。要启用此功能,您需要进入config/application.rb并添加以下行:
config.service\u static\u assets=true
阅读有关heroku的本文档-
希望有帮助。:) Rails 4 这个问题是
Hartl
教程中的一个常见问题-它源于在教程中使用Rails 3
,现在广泛使用更高版本
我试着寻找这方面的参考资料,但我找不到。我以前在什么地方找到过——我会再给你找一次的
无论如何,在Rails 4中,需要这个(我们在Rails 4应用程序中有这个):
这将为正确的对象设置配置代码块。我认为Rails在4.0+中改变了它的一些核心功能,这就是为什么您现在会遇到这个问题的原因谢谢您的回答,我以前被引导到过那个页面,但它不起作用。我仍然收到相同的错误消息。很抱歉,它没有帮助。看看我最近创建的回购协议,知道它在heroku-上有效。它与Hartl教程略有不同,因为我试图让Angularjs在Heroku上工作。这是工作页面-感谢您提供回购链接,我将对此进行调查。:)也谢谢你。我按照建议更改了development.rb,这破坏了使用“rails”启动服务器的能力,因此不得不恢复。很明显,我有一些版本混淆的事情。
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby app
To git@heroku.com:some-name.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:some-name.git'
#config/environments/development.rb
Rails.application.configure do