我之前发过类似的问题,但它没有解决我的特殊问题。我已经完成了迈克尔·哈特尔的Rails教程的第5章,虽然它到目前为止很棒,我目前有一个奇怪的问题。在本地测试了应用程序(并发现所有内容都按预期工作)后,我将应用程序推送到了Heroku。现在,当我点击Heroku页面页脚中的“关于”或“联系”页面链接时,我收到一条消息“我们遇到了问题”。所有其他链接工作,我已经检查了页脚部分文件,看起来很好。
日志似乎没有告诉我任何有用的东西。我将发布日志文件,页脚,Gemfile和路由。任何帮助将不胜感激,谢谢!
路线
SampleApp::Application.routes.draw do
get "users/new"
root to: 'static_pages#home'
match '/signup', to: 'users#new'
match '/help', to: 'static_pages#help'
match '/about', to: 'static_pages#About'
match '/contact', to: 'static_pages#contact'
end
footer partial
<footer class="footer">
<small>
<a href="http://railstutorial.org/">Rails Tutorial</a>
by Michael Hartl
</small>
<nav>
<ul>
<li><%= link_to "About", about_path %></li>
<li><%= link_to "Contact", contact_path %></li>
<li><a href="http://news.railstutorial.org/">News</a>
</ul>
</nav>
</footer>
的Gemfile
source 'https://rubygems.org'
ruby '1.9.3'
gem 'rails', '3.2.12'
gem 'bootstrap-sass', '2.1'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '3.2.5'
gem 'coffee-rails', '3.2.2'
gem 'uglifier', '1.2.3'
end
gem 'jquery-rails', '2.0.2'
group :test do
gem 'capybara', '1.1.2'
end
group :production do
gem 'pg', '0.12.2'
end
LOGS(更新:我有一组新的日志,似乎它声称这是一个丢失的模板,这不会丢失)我仍然不明白发生了什么。
2013-05-03T16:31:41.516275+00:00 app[web.1]: ActionView::MissingTemplate (Missing template static_pages/about, application/about with {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder]}. Searched in:
2013-05-03T16:31:41.516275+00:00 app[web.1]: ):
2013-05-03T16:31:41.516275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/path_set.rb:58:in `find'
2013-05-03T16:31:41.516275+00:00 app[web.1]: * "/app/app/views"
2013-05-03T16:31:41.516275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/lookup_context.rb:109:in `find'
2013-05-03T16:31:41.516275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/renderer/abstract_renderer.rb:3:in `find_template'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:110:in `_render_template'
2013-05-03T16:31:41.516275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/renderer/renderer.rb:36:in `render_template'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/renderer/renderer.rb:17:in `render'
2013-05-03T16:31:41.516275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/renderer/template_renderer.rb:34:in `determine_template'
2013-05-03T16:31:41.516275+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_view/renderer/template_renderer.rb:10:in `render'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/streaming.rb:225:in `_render_template'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rendering.rb:16:in `render'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:103:in `render_to_body'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/rendering.rb:88:in `render'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
2013-05-03T16:31:41.516531+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/ruby-1.9.3/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/core_ext/benchmark.rb:5:in `ms'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.12/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/instrumentation.rb:39:in `render'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:167:in `process_action'
2013-05-03T16:31:41.516766+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rendering.rb:10:in `process_action'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:414:in `_run__2984696832344586189__process_action__1371554362507721148__callbacks'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:81:in `run_callbacks'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in `__run_callback'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/callbacks.rb:17:in `process_action'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/action_controller/metal/rescue.rb:29:in `process_action'
2013-05-03T16:31:41.516989+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/notifications.rb:123:in `block in instrument'
2013-05-03T16:31:41.517214+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.12/lib/abstract_controller/base.rb:121:in `process'
同样,一切都在本地运作,所以我不明白会出现什么问题。我确实看到它似乎在寻找app / app / views我也不明白。任何有经验的人的帮助都会非常感激。
编辑:
contact.html.erb的内容
<% provide(:title, 'Contact Us') %>
<h1>Contact Us</h1>
<p>
The <a href="http://railstutorial.org/">Ruby on Rails Tutorial</a>
is a project to make a book and screencasts to teach web development
with <a href="http://rubyonrails.org/">Ruby on Rails</a>. This
is the sample application for the tutorial.
</p>
static_pages_controller.rb的内容
class StaticPagesController < ApplicationController
def home
end
def help
end
def about
end
def contact
end
end
答案 0 :(得分:2)
如果您还没有使用它,请确保已使用git
暂存所有要推送的文件(可能使用git add .
)然后提交(`git commit -m“foo “)然后推到Heroku。