我有一个页面,显示图像列表和添加到该图像的点数。在本地它工作正常,但现在我想让它在我的服务器上工作,当我访问该页面时,我收到一个错误,
我们很抱歉,但出了点问题。 如果您是应用程序所有者,请检查日志以获取更多信息
我的日志显示了这个,
I, [2015-02-03T06:51:31.352333 #28417] INFO -- : Started GET "/competitions/4" for 82.73.170.71 at 2015-02-03 06:51:31 -0500
I, [2015-02-03T06:51:31.353823 #28417] INFO -- : Processing by CompetitionsController#show as HTML
I, [2015-02-03T06:51:31.353886 #28417] INFO -- : Parameters: {"id"=>"4"}
I, [2015-02-03T06:51:31.364301 #28417] INFO -- : Rendered competitions/show.html.haml within layouts/application (7.8ms)
I, [2015-02-03T06:51:31.364563 #28417] INFO -- : Completed 500 Internal Server Error in 10ms
F, [2015-02-03T06:51:31.366172 #28417] FATAL -- :
ActionView::Template::Error (undefined method `points' for #<Picture:0x007f80f61ca038>):
54: Votes
55: - if signed_in?
56: - if current_user == @competition.user || current_user.administrator? || Time.now.in_time_zone("Amsterdam") <= @competition.deadline
57: = picture.points
58: -# = pluralize(picture.votes.count, "vote" )
59: -# %span
60: -# %div
app/views/competitions/show.html.haml:57:in `block in _app_views_competitions_show_html_haml___3029568455364587805_70095924335640'
app/views/competitions/show.html.haml:44:in `each'
app/views/competitions/show.html.haml:44:in `_app_views_competitions_show_html_haml___3029568455364587805_70095924335640'
我的show.html.haml
中的代码- if Time.now.in_time_zone("Amsterdam") >= @competition.deadline_signin
- @competition.pictures.shuffle.each do |picture|
.item
= link_to picture do
= image_tag(picture.image_url)
.content
%p
Door:
= picture.user.name
%p.vote
Votes
- if signed_in?
- if current_user == @competition.user || current_user.administrator? || Time.now.in_time_zone("Amsterdam") <= @competition.deadline
= picture.points
-# = pluralize(picture.votes.count, "vote" )
-# %span
-# %div
-# %p
-# \ #{pluralize(picture.votes.count, "" )}
= link_to picture.title, picture, :class => "art-name"
有谁看到问题可能是什么?
编辑“显示迁移”
20150131130944_add_points_to_pictures.rb
class AddPointsToPictures < ActiveRecord::Migration
def change
add_column :pictures, :points, :integer, default: 0
end
end
迁移行动,
deploy@appsynt:~/wisemonkeys/current$ RAILS_ENV=production bundle exec rake db:migrate
== AddPositionToPictures: migrating ==========================================
-- add_column(:pictures, :position, :integer)
-> 0.0046s
== AddPositionToPictures: migrated (0.0049s) =================================
== AddPointsToPictures: migrating ============================================
-- add_column(:pictures, :points, :integer, {:default=>0})
-> 0.0034s
== AddPointsToPictures: migrated (0.0037s) ===================================
答案 0 :(得分:0)
您是否在许可证(Rails 4)
上添加了Picture控制器上的点数或
在图片模型中attr_accessible(Rails3)