2

開発マシンで問題なく動作する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

このエラーの原因を見つけるのに役立つことを願っています:)

ありがとう!

4

3 に答える 3

2

変更してみてください:
... :partial => '/choices/choice.html.erb'

に:
... :partial => '/choices/choice'

ビューとコントローラーで。より明確にするために、Using Partialを確認してください。

于 2012-11-12T09:46:31.783 に答える
0

私のWebアプリでも同じように誤解を招くようなエラーが発生し、本番環境でのみ発生しますが、開発ではすべて正常に機能します。

私のログは次のとおりです。

NoMethodError (undefined method `call' for :silence:Symbol):
  app/controllers/users_controller.rb:77:in `block in XXX'
  app/controllers/users_controller.rb:77:in `each'
  app/controllers/users_controller.rb:77:in `XXX'
  app/controllers/users_controller.rb:32:in `YYY'
  app/controllers/application_controller.rb:46:in `ZZZ'

デバッガーが指摘するコンテキストはまったく異なることに注意してください。このエラーは本番環境でのみ発生するため、コーディングのバグが原因である可能性はないと思います。そこで、開発設定と本番設定の違いを調べ始めたところ、最終的に次の行を追加して、うるさい Heroku Deprecation Warnings を取り除くことに気付きました。

config.active_support.deprecation = :silence

しかし、「:silence」シンボルは DEFAULT_BEHAVIORS[:silence] でまだ定義されていなかったため ( https://github.com/rails/rails/pull/5986を確認してください)、問題が発生しました。Heroku を使用しているとのことですが、これが本当にエラーの原因であったかどうかを確認していただけますか?

于 2013-04-26T19:30:15.590 に答える