我的本地服务器上的一切都运行良好,但当我在heroku上部署时,我得到:
ActionView::Template::Error (uninitialized constant Report::View):
我不确定发生了什么。有任何想法吗?我的迁移遇到了一些麻烦,所以我做了,并修复了它,迁移了它,并把它推回去了。然后heroku restart
。
整个日志:
app[web.1]: Started GET "/reports" for 76.28.58.42 at 2012-02-20 18:55:19 -0800
app[web.1]:
app[web.1]:
app[web.1]: Processing by ReportsController#index as HTML
app[web.1]: 24: <% if current_user.access >= 3 %>
app[web.1]: 29: <img src="<%= image_path('newcomment.png') %>" id="indicator">
app[web.1]: app/models/report. `indicator'
app[web.1]:
heroku[router]: GET dyno=web.1 queue=0 wait=0ms service=39ms status=500 bytes=728
app[web.1]: ActionView::Template::Error (uninitialized constant Report::View):
app[web.1]: app/views/reports/index.html. `_app_views_reports_index_html_erb__2344284806505066880_37258240__573144668886847782'
app[web.1]:
app[web.1]:
app[web.1]: 23: <% end %>
app[web.1]: 26: <% if report.indicator(current_user) == 1 %>
app[web.1]: 27: <img src="<%= image_path('newreportwithcomment.png') %>" id="indicator">
app[web.1]: Rendered reports/index.html.erb within layouts/application (29.3ms)
app[web.1]: 28: <% elsif report.indicator(current_user) == 2 %>
app[web.1]: 25: <td>
app[web.1]: app/views/reports/index.html. `block in _app_views_reports_index_html_erb__2344284806505066880_37258240__573144668886847782'
app[web.1]: app/controllers/reports_controller. `index'
heroku[nginx]: 76.28.58.42 - - [21/Feb/2012:02:55:19 +0000] "GET /reports HTTP/1.1" 500 728 "" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11" repair.heroku.com
app[web.1]: Completed 500 Internal Server Error in 33ms
报告控制器:
def index
if current_user.access >= 2
= Report.search(params[:search]).paginate(:page => params[:page], :per_page => 25).order('created_at DESC')
else
= Report.where("created_at > ?", 30.days.ago).paginate(:page => params[:page], :per_page => 25).order('created_at DESC')
end
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => }
end
end
reports / views / index(从第18行开始)
<% .each do |report| %>
<% if current_user.access >= 2 %>
<tr class="<%= cycle('odd-line', 'even-line') %>" onClick="location.href='reports/<%= report.id %>'" style="">
<% else %>
<tr class="<%= cycle('odd-line', 'even-line') %>">
<% end %>
<% if current_user.access >= 3 %>
<td>
<% if report.indicator(current_user) == 1 %>
<img src="<%= image_path('newreportwithcomment.png') %>" id="indicator">
<% elsif report.indicator(current_user) == 2 %>
<img src="<%= image_path('newcomment.png') %>" id="indicator">
<% elsif report.indicator(current_user) == 3 %>
<img src="<%= image_path('newreport.png') %>" id="indicator">
<% end %>
</td>
<% end %>
report.rb(从第24行开始)
def indicator(current_user)
if self.views.where('user_id = ?', current_user.id).first != nil
= self.views.where('user_id = ?', current_user.id).first
if self.comments.first != nil
if self.comments.last.created_at > .updated_at
return 2
else
return 0
end
else
return 0
end
elsif self.comments.first !=nil
return 1
else
return 3
end
end
view.rb
class View < ActiveRecord::Base
belongs_to :user
belongs_to :report
end
答案 0 :(得分:0)
我需要了解更多关于git的信息。
我回去做了git add .
然后做出了推动并且一切正常。