Homeland ruby-china 创建 notification 失败,怎么解?

hunter · 2012年04月11日 · 最后由 hunter 回复于 2012年04月11日 · 3402 次阅读

手动测试也遇到了这个问题,看上去像是模型定义里面出错了。

我现在所有的库能更新读更新到最高版本了,reply 的模型定义出错了吗,和 inverse 有关。

NoMethodError (undefined method `sub' for Rforum::Reply:Class):
  mongoid (2.4.3) lib/mongoid/relations/metadata.rb:117:in `class_name'
  mongoid (2.4.3) lib/mongoid/relations/metadata.rb:535:in `klass'
  mongoid (2.4.3) lib/mongoid/relations/metadata.rb:851:in `determine_inverse_relation'
  mongoid (2.4.3) lib/mongoid/relations/metadata.rb:884:in `inverse_relation'
  mongoid (2.4.3) lib/mongoid/relations/metadata.rb:380:in `inverse'
  mongoid (2.4.3) lib/mongoid/relations/bindings/referenced/in.rb:24:in `block in bind'
  mongoid (2.4.3) lib/mongoid/threaded/lifecycle.rb:55:in `_binding'
  mongoid (2.4.3) lib/mongoid/relations/bindings/referenced/in.rb:23:in `bind'
  mongoid (2.4.3) lib/mongoid/relations/proxy.rb:20:in `bind_one'
  mongoid (2.4.3) lib/mongoid/relations/referenced/in.rb:24:in `block in initialize'
  mongoid (2.4.3) lib/mongoid/relations/proxy.rb:36:in `init'
  mongoid (2.4.3) lib/mongoid/relations/referenced/in.rb:22:in `initialize'
  mongoid (2.4.3) lib/mongoid/relations/accessors.rb:44:in `new'
  mongoid (2.4.3) lib/mongoid/relations/accessors.rb:44:in `create_relation'
  mongoid (2.4.3) lib/mongoid/relations/accessors.rb:26:in `build'
  mongoid (2.4.3) lib/mongoid/relations/accessors.rb:130:in `block (2 levels) in setter'
  mongoid (2.4.3) lib/mongoid/attributes/processing.rb:139:in `block in process_relations'
  mongoid (2.4.3) lib/mongoid/attributes/processing.rb:134:in `each_pair'
  mongoid (2.4.3) lib/mongoid/attributes/processing.rb:134:in `process_relations'
  mongoid (2.4.3) lib/mongoid/attributes/processing.rb:122:in `process_pending'
  mongoid (2.4.3) lib/mongoid/attributes/processing.rb:29:in `process'
  mongoid (2.4.3) lib/mongoid/document.rb:132:in `block in initialize'
  mongoid (2.4.3) lib/mongoid/threaded/lifecycle.rb:84:in `_building'
  mongoid (2.4.3) lib/mongoid/document.rb:126:in `initialize'
  mongoid (2.4.3) lib/mongoid/persistence.rb:177:in `new'
  mongoid (2.4.3) lib/mongoid/persistence.rb:177:in `block in create'
  mongoid (2.4.3) lib/mongoid/threaded/lifecycle.rb:173:in `_creating'
  mongoid (2.4.3) lib/mongoid/persistence.rb:176:in `create'
  /home/netmon/vob/w090/Rforum/app/models/rforum/reply.rb:71:in `send_topic_reply_notification'
  activesupport (3.2.3) lib/active_support/callbacks.rb:432:in `_run__748569039__create__484712984__callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_create_callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:43:in `block in run_callbacks'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `call'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `run_cascading_callbacks'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:42:in `run_callbacks'
  mongoid (2.4.3) lib/mongoid/persistence/insertion.rb:25:in `block (2 levels) in prepare'
  activesupport (3.2.3) lib/active_support/callbacks.rb:436:in `_run__748569039__save__484712984__callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:43:in `block in run_callbacks'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `call'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:68:in `run_cascading_callbacks'
  mongoid (2.4.3) lib/mongoid/callbacks.rb:42:in `run_callbacks'
  mongoid (2.4.3) lib/mongoid/persistence/insertion.rb:24:in `block in prepare'
  mongoid (2.4.3) lib/mongoid/persistence/insertion.rb:22:in `tap'
  mongoid (2.4.3) lib/mongoid/persistence/insertion.rb:22:in `prepare'
  mongoid (2.4.3) lib/mongoid/persistence/operations/insert.rb:26:in `persist'
  mongoid (2.4.3) lib/mongoid/persistence.rb:49:in `insert'
  mongoid (2.4.3) lib/mongoid/persistence.rb:154:in `upsert'
  /home/netmon/vob/w090/Rforum/app/controllers/rforum/replies_controller.rb:11:in `create'
  actionpack (3.2.3) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.3) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.3) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.3) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.3) lib/active_support/callbacks.rb:447:in `_run__284678346__process_action__577987593__callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.3) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.3) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.3) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.3) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.3) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.3) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.3) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
  mongo-rails-instrumentation (0.2.4) lib/mongo/rails/instrumentation/controller_runtime.rb:13:in `process_action'
  actionpack (3.2.3) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.3) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.3) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.3) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.3) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.3) lib/journey/router.rb:68:in `block in call'
  journey (1.0.3) lib/journey/router.rb:56:in `each'
  journey (1.0.3) lib/journey/router.rb:56:in `call'
  actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/railtie/configurable.rb:30:in `method_missing'
  journey (1.0.3) lib/journey/router.rb:68:in `block in call'
  journey (1.0.3) lib/journey/router.rb:56:in `each'
  journey (1.0.3) lib/journey/router.rb:56:in `call'
  actionpack (3.2.3) lib/action_dispatch/routing/route_set.rb:600:in `call'
  mongoid (2.4.3) lib/rack/mongoid/middleware/identity_map.rb:33:in `block in call'
  mongoid (2.4.3) lib/mongoid.rb:132:in `unit_of_work'
  mongoid (2.4.3) lib/rack/mongoid/middleware/identity_map.rb:33:in `call'
  warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
  warden (1.1.1) lib/warden/manager.rb:34:in `catch'
  warden (1.1.1) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.1) lib/rack/etag.rb:23:in `call'
  rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/cookies.rb:338:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `_run__538937713__call__484712984__callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.3) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.3) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.3) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
  /home/netmon/vob/github/quiet_assets/lib/quiet_assets.rb:12:in `call_with_quiet_assets'
  actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.3) lib/rails/engine.rb:479:in `call'
  railties (3.2.3) lib/rails/application.rb:220:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
  /usr/local/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
  /usr/local/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'


  Rendered /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (3.9ms)
  Rendered /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.9ms)
  Rendered /usr/local/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (10.2ms)

怀疑是 Notification 的 namespace 引起的,再研究下,估计也只有自己搞定了

没看明白阿,你做了什么

是啊,我就做了 engine 分离了啊,reply 都可以了,就是 notification reply 创建失败,我没有改动啥啊

搞定了,全部放到 engine 下面的 namespace 就好了,曾经头痛的问题。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号