неинициализированная постоянная ошибка, только на героку - PullRequest
2 голосов
/ 21 февраля 2012

Все отлично работает на моем локальном сервере, но когда я развертываю на 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

отчеты / просмотры / индекс (начиная со строки 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

1 Ответ

0 голосов
/ 21 февраля 2012

Мне нужно больше узнать о git.

Я вернулся и сделал git add ., затем зафиксировал и нажал, и все работало нормально.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...