未初始化的常量错误,仅限于heroku
一切都在我的本地服务器上运行良好,但是当我在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: = 3 %> app[web.1]: 29: " 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: app[web.1]: 26: app[web.1]: 27: " id="indicator"> app[web.1]: Rendered reports/index.html.erb within layouts/application (29.3ms) app[web.1]: 28: app[web.1]: 25: 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行开始)
= 2 %> <tr class="" onClick="location.href='reports/'" style=""> <tr class=""> = 3 %> " id="indicator"> " id="indicator"> " id="indicator">
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
我需要了解更多关于git的知识。
我回去做了git add .
然后承诺并推动一切正常。
- Link_to(image_tag …)在本地工作但在Heroku部署中中断
- Rails heroku无效配置选项
- 即使我在开发块中有sqlite,Heroku也不接受推送
- Heroku中的SSL与自定义域
- Heroku如何将http://重定向到http:// www
- 如何将Git子目录推送到heroku?
- 如何从使用Heroku PG备份的备份中恢复三个项目?
- 这些Ruby版本中存在`heroku’命令:
- API请求 – OpenSSL :: SSL :: SSLError:SSL_connect SYSCALL返回= 5 errno = 0 state = SSLv3读取服务器hello A
Interesting Posts
Rails – Errno :: EACCES(权限被拒绝)上传用户的头像时
尝试在Heroku上部署应用程序时出现错误“未定义方法”load_defaults“”
Heroku Scheduler:CreditsController的未定义局部变量或方法`params’:Class
Ruby on Rails,Paperclip,亚马逊AWS S3和Heroku
无法在Heroku上使用Gmail发送电子邮件
Heroku应用程序崩溃,在尝试heroku rake db:migrate时收到“无效的DATABASE URL”
Rails 3.2:Heroku推送拒绝,没有检测到Cedar支持的应用程序
$ git push heroku master – 没有错误消息,但更改未显示在Web应用程序上
注销不使用Heroku – 使用Devise gem和Rails 4
如何在Heroku上使用rdiscount?