在您的博文中:http://pakyow.com/blog/2015/03/24/ui-intro
我正在跟随并在为视图partial:form配置默认路由时收到错误,其中包含空绑定集。
view.partial(:form).scope[:message].bind({})
刷新浏览器时,下面给出了一个错误。 不知道如何解决这个或我需要检查的依赖项。
服务器错误:
The error originated on line 104 of 'C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb' and generated the following stack trace:
wrong number of arguments (0 for 1)
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view.rb:104:in `scope'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-presenter-0.9.1/pakyow-presenter/lib/presenter/view_context.rb:44:in `method_missing'
C:/Users/Anna/Documents/wallyou/app/lib/routes.rb:7:in `block (2 levels) in <top (required)>'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `instance_exec'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `block in call_fns'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `each'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:102:in `call_fns'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:140:in `block in trampoline'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:139:in `catch'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:139:in `trampoline'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/router.rb:46:in `perform'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:245:in `block in process'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:242:in `catch'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:242:in `process'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/app.rb:223:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/reloader.rb:10:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/logger.rb:118:in `block in call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/logger.rb:129:in `time'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/logger.rb:116:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/pakyow-core-0.9.1/pakyow-core/lib/core/middleware/static.rb:20:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.6.1/lib/rack/methodoverride.rb:22:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/rack-1.6.1/lib/rack/builder.rb:153:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/puma-2.11.2/lib/puma/server.rb:507:in `handle_request'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/puma-2.11.2/lib/puma/server.rb:375:in `process_client'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/puma-2.11.2/lib/puma/server.rb:262:in `block in run'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/puma-2.11.2/lib/puma/thread_pool.rb:104:in `call'
C:/Ruby200/lib/ruby/gems/2.0.0/gems/puma-2.11.2/lib/puma/thread_pool.rb:104:in `block in spawn_thread'
答案 0 :(得分:1)
scope
应该是一个函数调用,如下所示:
view.partial(:form).scope(:message).bind({})
你拥有它的方式,message
用方括号括起来。