ActiveAdmin - 所有类型的update动作在struct中都没有显示成员

时间:2014-02-18 18:33:43

标签: activeadmin

我正在设置ActiveAdmin,当我使用编辑操作来更新我提交的任何模型时,会导致struct'样式中的'no member'错误。我当然可以看到发布的结构中的model_name IS,所以我很困惑。我不确定我做错了什么,也不确定如何解决。我没有更改更新操作。我几乎是一个Rails新手,但是活跃的管理员表现不错。对其中一个的回应是......

NameError in Manage::ProductGroupsController#update

结构

中没有成员'product_group'

Rails.root:/ var / hosts / linode_staging / releases / 20140218181435 / aotv2

应用程序跟踪|框架跟踪|完整追踪 /usr/local/rvm/gems/ruby-2.1.0/bundler/gems/inherited_resources-e4fb9fc80448/lib/inherited_resources/base_helpers.rb:322:in []' /usr/local/rvm/gems/ruby-2.1.0/bundler/gems/inherited_resources-e4fb9fc80448/lib/inherited_resources/base_helpers.rb:322:in build_resource_params' /usr/local/rvm/gems/ruby-2.1.0/bundler/gems/inherited_resources-e4fb9fc80448/lib/inherited_resources/base_helpers.rb:316:in resource_params' /usr/local/rvm/gems/ruby-2.1.0/bundler/gems/inherited_resources-e4fb9fc80448/lib/inherited_resources/actions.rb:45:in update' actionpack(4.0.1)lib / action_controller / metal / implicit_render.rb:4:in send_action' actionpack (4.0.1) lib/abstract_controller/base.rb:189:in process_action' actionpack(4.0.1)lib / action_controller / metal / rendering.rb:10:在process_action中的process_action' actionpack (4.0.1) lib/abstract_controller/callbacks.rb:18:in块中 activesupport(4.0.1)lib / active_support / callbacks.rb:413:in _run__4471285646399910144__process_action__callbacks' activesupport (4.0.1) lib/active_support/callbacks.rb:80:in run_callbacks' actionpack(4.0.1)lib / abstract_controller / callbacks.rb:17:in process_action' actionpack (4.0.1) lib/action_controller/metal/rescue.rb:29:in process_action' actionpack(4.0.1)lib / action_controller / metal / instrumentation.rb:31:在block in process_action' activesupport (4.0.1) lib/active_support/notifications.rb:159:in块中的仪器' activesupport(4.0.1)lib / active_support / notifications / instrumenter.rb:20:in instrument' activesupport (4.0.1) lib/active_support/notifications.rb:159:in instrument' actionpack(4.0.1)lib / action_controller / metal / instrumentation.rb:30:in process_action' actionpack (4.0.1) lib/action_controller/metal/params_wrapper.rb:245:in process_action' activerecord(4.0.1)lib / active_record / railties / controller_runtime.rb:18:in process_action' actionpack (4.0.1) lib/abstract_controller/base.rb:136:in process' actionpack(4.0.1)lib / abstract_controller / rendering.rb:44:in process' actionpack (4.0.1) lib/action_controller/metal.rb:195:in dispatch' actionpack(4.0.1)lib / action_controller / metal / rack_delegation.rb:13:in dispatch' actionpack (4.0.1) lib/action_controller/metal.rb:231:in block in action' actionpack(4.0.1)lib / action_dispatch / routing / route_set.rb:80:in call' actionpack (4.0.1) lib/action_dispatch/routing/route_set.rb:80:in dispatch' actionpack(4.0.1)lib / action_dispatch / routing / route_set.rb:48:in call' actionpack (4.0.1) lib/action_dispatch/journey/router.rb:71:in block in call' actionpack(4.0.1)lib / action_dispatch / journey / router.rb:59:in each' actionpack (4.0.1) lib/action_dispatch/journey/router.rb:59:in call' actionpack(4.0.1)lib / action_dispatch / routing / route_set.rb:680:在call' warden (1.2.3) lib/warden/manager.rb:35:in块中调用' warden(1.2.3)lib / warden / manager.rb:34:in catch' warden (1.2.3) lib/warden/manager.rb:34:in call' rack(1.5.2)lib / rack / etag.rb:23:in call' rack (1.5.2) lib/rack/conditionalget.rb:35:in call' rack(1.5.2)lib / rack / head.rb:11:in call' actionpack (4.0.1) lib/action_dispatch/middleware/params_parser.rb:27:in call' actionpack(4.0.1)lib / action_dispatch / middleware / flash.rb:241:in call' rack (1.5.2) lib/rack/session/abstract/id.rb:225:in context' rack(1.5.2)lib / rack / session / abstract / id.rb:220:in call' actionpack (4.0.1) lib/action_dispatch/middleware/cookies.rb:486:in call' activerecord(4.0.1)lib / active_record / query_cache.rb:36:in call' activerecord (4.0.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in call' actionpack(4.0.1)lib / action_dispatch / middleware / callbacks.rb:29:在block in call' activesupport (4.0.1) lib/active_support/callbacks.rb:373:in 运行 _4380831815421705085_ 调用 _callbacks' activesupport(4.0.1)lib / active_support / callbacks.rb:80:in run_callbacks' actionpack (4.0.1) lib/action_dispatch/middleware/callbacks.rb:27:in call' actionpack(4.0.1)lib / action_dispatch / middleware / remote_ip.rb:76:in call' actionpack (4.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in call' actionpack(4.0.1)lib / action_dispatch / middleware / show_exceptions.rb:30:in call' railties (4.0.1) lib/rails/rack/logger.rb:38:in call_app' railties(4.0.1)lib / rails / rack / logger.rb:20:block in call' activesupport (4.0.1) lib/active_support/tagged_logging.rb:67:in阻止标记' activesupport(4.0.1)lib / active_support / tagged_logging.rb:25:in tagged' activesupport (4.0.1) lib/active_support/tagged_logging.rb:67:in tagged' railties(4.0.1)lib / rails / rack / logger.rb:20:in call' actionpack (4.0.1) lib/action_dispatch/middleware/request_id.rb:21:in call' rack(1.5.2)lib / rack / methodoverride.rb:21:in call' rack (1.5.2) lib/rack/runtime.rb:17:in call' activesupport(4.0.1)lib / active_support / cache / strategy / local_cache.rb:83:in call' actionpack (4.0.1) lib/action_dispatch/middleware/static.rb:64:in call' rack(1.5.2)lib / rack / sendfile.rb:112:in call' railties (4.0.1) lib/rails/engine.rb:511:in call' railties(4.0.1)lib / rails / application.rb:97:in call' railties (4.0.1) lib/rails/railtie/configurable.rb:30:in method_missing' passenger(4.0.37)lib / phusion_passenger / rack / thread_handler_extension.rb:77:in process_request' passenger (4.0.37) lib/phusion_passenger/request_handler/thread_handler.rb:142:in accept_and_process_next_request' passenger(4.0.37)lib / phusion_passenger / request_handler / thread_handler.rb:110:在main_loop' passenger (4.0.37) lib/phusion_passenger/request_handler.rb:448:in块中(3个级别)在start_threads中 请求

参数:

{ “UTF8”=> “中✓”,  “_method”=> “中的补丁”,  “authenticity_token”=> “中p0xsTbNLexYflBaGSCX4KAvp4AGjRNIFueTUoIwAClM =”,  “product_group”=> {“title”=>“REST API”,  “description”=>“API的订阅”,  “源”=> “中tjchambers”},  “commit”=>“更新产品组”,  “ID”=> “中9”} 切换会话转储 切换env转储 响应

接头:

1 个答案:

答案 0 :(得分:1)

您很可能没有在product_group.rb中包含强参数 请查看此文档https://github.com/gregbell/active_admin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters

应该指向正确的方向。

最佳, 的Jeroen