RubyAMF使ってsaveしようとするとエラーになる問題(未解決)
AMF使って受けたデータをほげほげしてsaveしようとしたらエラーが出る。
127.0.0.1 - - [22/May/2008:17:41:35 JST] "POST /rubyamf/gateway HTTP/1.1" 200 311 http://localhost:3000/bin/flex.swf -> /rubyamf/gateway stack level too deep {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:172:in `write_amf3_integer' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:208:in `write_amf3_string' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:230:in `write_amf3_object' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:225:in `each' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:225:in `write_amf3_object' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:167:in `write_amf3' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:231:in `write_amf3_object' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:225:in `each' (以下6000行ぐらい同じエラーが続く) {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:225:in `write_amf3_object' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:160:in `write_amf3' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:231:in `write_amf3_object' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:225:in `each' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:225:in `write_amf3_object' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:152:in `write_amf3' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:76:in `write' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:68:in `run' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:54:in `upto' {RAILS_ROOT}vendor/plugins/rubyamf/io/amf_serializer.rb:54:in `run' {RAILS_ROOT}vendor/plugins/rubyamf/app/filters.rb:66:in `run' {RAILS_ROOT}vendor/plugins/rubyamf/app/filters.rb:11:in `run' {RAILS_ROOT}vendor/plugins/rubyamf/app/filters.rb:10:in `each' {RAILS_ROOT}vendor/plugins/rubyamf/app/filters.rb:10:in `run' {RAILS_ROOT}vendor/plugins/rubyamf/app/rails_gateway.rb:28:in `service' {RAILS_ROOT}app/controllers/rubyamf_controller.rb:16:in `gateway' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `send' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:1158:in `perform_action_without_filters' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:697:in `call_filters' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:689:in `perform_action_without_benchmark' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' /opt/local/lib/ruby/1.8/benchmark.rb:293:in `measure' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/rescue.rb:199:in `perform_action_without_caching' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:678:in `perform_action' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache' /opt/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/query_cache.rb:8:in `cache' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/caching.rb:677:in `perform_action' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `send' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:524:in `process_without_filters' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/filters.rb:685:in `process_without_session_management_support' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/session_management.rb:123:in `process' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/base.rb:388:in `process' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:171:in `handle_request' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:115:in `dispatch' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:126:in `dispatch_cgi' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/dispatcher.rb:9:in `dispatch' /opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:112:in `handle_dispatch' /opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:78:in `service' /opt/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /opt/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /opt/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start' /opt/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /opt/local/lib/ruby/1.8/webrick/server.rb:95:in `start' /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `each' /opt/local/lib/ruby/1.8/webrick/server.rb:92:in `start' /opt/local/lib/ruby/1.8/webrick/server.rb:23:in `start' /opt/local/lib/ruby/1.8/webrick/server.rb:82:in `start' /opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/webrick_server.rb:62:in `dispatch' /opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/servers/webrick.rb:66 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in `new_constants_in' /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in `require' /opt/local/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39 /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:27:in `require' script/server:3
同種のエラーがないか調べているんだけど、gettext絡みでRailsがエラーになることもあるらしい。そもそもgettext入れていないしMacPortsにはlibgettextがないので関係がない。そもそもエラー出てんのRubyAMFプラグインの部分でだしね。
RubyAMFで"stack level too deep"が出ているものを探してみるとGoogle グループというものを見つけたけど、エラー箇所が違うのでよく分からない。というかRubyAMFの情報が少なすぎて何がなんだか分からない。
仕方がないのでエラーで出ている行のソースを見てみた。AMF3に書く際に渡しているハッシュがVoHashか否かを見ているらしいけど、VoHashってなんだ?VoなHash?Voと言うとValueObjectのことだろうか。しかしValueObjectは名前だけ知っているけど何なのかは知らない。
とりあえずよく分からないのでまだ調べている最中。
ちなみに
respond_to do |format| if @hoge.save format.amf { render :amf => @hoge } else format.amf { render :amf => @hoge.error } end end
respond_to do |format| unless @hoge.nil? format.amf { render :amf => @hoge } @hoge.save else format.amf { render :amf => @hoge.error } end end
@hoge.save respond_to do |format| unless @hoge.nil? format.amf { render :amf => @hoge } else format.amf { render :amf => @hoge.error } end end
こう書くとエラーなんだけど
respond_to do |format| unless @hoge.nil? format.amf { render :amf => @hoge } else format.amf { render :amf => @hoge.error } end end
こう書いたり
respond_to do |format| if @hoge.save format.xml { render :xml => @hoge } else format.xml { render :xml => @hoge.error } end end
こう書いたりするとエラーにはならない。のでamfで返す場合でsaveを使うとエラーになるっぽい。そしてsaveの位置は特に関係がない、と。