我有一个 Rails 应用程序,在我的开发机器上运行良好,但是当我将它部署到 Heroku 时,在部署页面后尝试加载页面时收到以下错误消息。
ActionView::Template::Error (undefined method `call' for :silence:Symbol):
31: <div id="tickets">
32: <div id="subline">Tickets open for trading</div>
33: <% if not @tickets.blank? %>
34: <%= render( :partial => '/choices/choice.html.erb', :locals => { :choice => @tickets} ) %>
35: <% end %>
36: </div>
app/views/home/index.html.erb:34:in `_app_views_home_index_html_erb___4151329774010405498_38984040'
app/controllers/home_controller.rb:108:in `index'
我似乎无法弄清楚出了什么问题,因为它在我自己的机器上工作得很好,所以任何帮助都会非常有用:)
编辑1:
这是我的家庭控制器的一部分,与上述相关..
class HomeController < ApplicationController
def index
@tickets = Choice.betable(current_user).where("choices.created_at > ?", Time.at(params[:after].to_i + 1).utc).order("choices.created_at DESC")
respond_to do |format|
format.html
format.json do
@html_choice = render_to_string( :partial => '/choices/choice.html.erb', :locals => { :choice => @tickets} )
@html_active_choices = render_to_string( :partial => '/shared/active_choices.html.erb', :locals => { :active_choices => @active_choices} )
@html_active_bets = render_to_string( :partial => '/shared/active_bets.html.erb', :locals => { :active_bets => @active_bets} )
@html_spotprices_today = render_to_string( :partial => '/shared/spotprices_today.html.erb', :locals => { :spotprices_today => @spotprices_today} )
render :json => { :success => true, :html_choice => @html_choice, :html_active_choices => @html_active_choices, :html_active_bets => @html_active_bets, :html_spotprices_today => @html_spotprices_today }
end
end
end
end
json 响应被 [Pusher][1] 用于将更新数据的 websocket 推送到站点。
您可以在下面找到日志文件:
2012-11-12T06:04:20+00:00 app[web.1]: => Booting Thin
2012-11-12T06:04:20+00:00 app[web.1]: => Rails 3.2.8 application starting in production on http://0.0.0.0:40112
2012-11-12T06:04:20+00:00 app[web.1]: => Call with -d to detach
2012-11-12T06:04:20+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-11-12T06:04:20+00:00 app[web.1]: >> Thin web server (v1.3.1 codename Triple Espresso)
2012-11-12T06:04:20+00:00 app[web.1]: >> Maximum connections set to 1024
2012-11-12T06:04:20+00:00 app[web.1]: >> Listening on 0.0.0.0:40112, CTRL+C to stop
2012-11-12T06:04:24+00:00 app[web.1]:
2012-11-12T06:04:24+00:00 app[web.1]:
2012-11-12T06:04:24+00:00 app[web.1]: Started GET "/rails/info/properties" for 157.55.34.32 at 2012-11-12 06:04:24 +0000
2012-11-12T06:04:24+00:00 heroku[router]: GET mydomain.com/rails/info/properties dyno=web.1 queue=0 wait=0ms service=51ms status=404 bytes=728
2012-11-12T06:04:24+00:00 heroku[nginx]: 157.55.34.32 - - [12/Nov/2012:06:04:24 +0000] "GET /rails/info/properties HTTP/1.1" 404 728 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" mydomain.com
2012-11-12T06:04:24+00:00 app[web.1]:
2012-11-12T06:04:24+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/rails/info/properties"):
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:26:in `call_app'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/logger.rb:16:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/request_id.rb:22:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:245:in `fetch'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:51:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/engine.rb:479:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.8/lib/action_dispatch/middleware/static.rb:62:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:136:in `forward'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:185:in `lookup'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:66:in `call!'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/application.rb:223:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/rack/log_tailer.rb:17:in `call'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:80:in `block in pre_process'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `catch'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:78:in `pre_process'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:53:in `process'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/connection.rb:38:in `receive_data'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/backends/base.rb:61:in `start'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/thin-1.3.1/lib/thin/server.rb:159:in `start'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/handler/thin.rb:13:in `run'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:55:in `block in <top (required)>'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands/server.rb:70:in `start'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `tap'
2012-11-12T06:04:24+00:00 app[web.1]: vendor/bundle/ruby/1.9.1/gems/railties-3.2.8/lib/rails/commands.rb:50:in `<top (required)>'
2012-11-12T06:04:24+00:00 app[web.1]: script/rails:6:in `require'
2012-11-12T06:04:24+00:00 app[web.1]: script/rails:6:in `<main>'
2012-11-12T06:04:24+00:00 app[web.1]:
2012-11-12T06:04:24+00:00 app[web.1]:
2012-11-12T08:56:34+00:00 heroku[router]: GET www.mydomain.com/ dyno=web.1 queue=0 wait=0ms service=607ms status=500 bytes=643
2012-11-12T08:56:34+00:00 heroku[nginx]: 87.60.190.9 - - [12/Nov/2012:08:56:34 +0000] "GET / HTTP/1.1" 500 643 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:14.0) Gecko/20100101 Firefox/14.0.1" www.mydomain.com
希望这有助于找到错误的原因:)
谢谢!