Q:undefined method `reorder' for nil:NilClass

the problem have sovled throught changing the ruby version 

I used rails 3.2 and ruby .2.2 has this problem,  changing the lower ruby version will sovle this problem.

because the rails3.2 match ruby2.2, If the database has not data to show in index,html, the problem will occur.

relative link: https://github.com/activeadmin/activeadmin/pull/3760

Showing .rvm/gems/ruby-2.2.2/gems/activeadmin-0.6.0/app/views/active_admin/resource/index.html.arb where line #2 raised:

undefined method `reorder' for nil:NilClass

    | Framework Trace | Full Trace

activeadmin (0.6.0) lib/active_admin/helpers/collection.rb:11:in `collection_size'
activeadmin (0.6.0) lib/active_admin/helpers/collection.rb:19:in `collection_is_empty?'
activeadmin (0.6.0) lib/active_admin/views/pages/index.rb:44:in `items_in_collection?'
activeadmin (0.6.0) lib/active_admin/views/pages/index.rb:48:in `build_collection'
activeadmin (0.6.0) lib/active_admin/views/pages/index.rb:27:in `block in main_content'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.0.3) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:14:in `batch_action_form'
activeadmin (0.6.0) lib/active_admin/views/pages/index.rb:35:in `wrap_with_batch_action_form'
activeadmin (0.6.0) lib/active_admin/views/pages/index.rb:25:in `main_content'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:78:in `block (2 levels) in build_main_content_wrapper'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.0.3) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:14:in `div'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:77:in `block in build_main_content_wrapper'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.0.3) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:14:in `div'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:76:in `build_main_content_wrapper'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:60:in `block in build_page_content'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.0.3) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:14:in `div'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:59:in `build_page_content'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:42:in `block (2 levels) in build_page'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:31:in `block in build_tag'
arbre (1.0.3) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:14:in `div'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:39:in `block in build_page'
arbre (1.0.3) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:38:in `build_page'
activeadmin (0.6.0) lib/active_admin/views/pages/base.rb:10:in `build'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
arbre (1.0.3) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.3) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
activeadmin (0.6.0) app/views/active_admin/resource/index.html.arb:2:in `block in __home_zhenzhen__rvm_gems_ruby_______gems_activeadmin_______app_views_active_admin_resource_index_html_arb___449094877685351056_32323960'
arbre (1.0.3) lib/arbre/context.rb:45:in `instance_eval'
arbre (1.0.3) lib/arbre/context.rb:45:in `initialize'
activeadmin (0.6.0) app/views/active_admin/resource/index.html.arb:1:in `new'
activeadmin (0.6.0) app/views/active_admin/resource/index.html.arb:1:in `__home_zhenzhen__rvm_gems_ruby_______gems_activeadmin_______app_views_active_admin_resource_index_html_arb___449094877685351056_32323960'
actionpack (3.2.8) lib/action_view/template.rb:145:in `block in render'
activesupport (3.2.8) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.8) lib/action_view/template.rb:143:in `render'
actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.8) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.8) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.8) lib/action_view/renderer/template_renderer.rb:18:in `render'
actionpack (3.2.8) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.8) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.8) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.8) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.8) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.8) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.8) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/zhenzhen/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
activesupport (3.2.8) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:39:in `render'
activeadmin (0.6.0) lib/active_admin/resource_controller/actions.rb:13:in `block (2 levels) in index'
actionpack (3.2.8) lib/action_controller/metal/responder.rb:230:in `call'
actionpack (3.2.8) lib/action_controller/metal/responder.rb:230:in `default_render'
actionpack (3.2.8) lib/action_controller/metal/responder.rb:160:in `to_html'
responders (1.1.2) lib/responders/flash_responder.rb:107:in `to_html'
actionpack (3.2.8) lib/action_controller/metal/responder.rb:153:in `respond'
actionpack (3.2.8) lib/action_controller/metal/responder.rb:146:in `call'
actionpack (3.2.8) lib/action_controller/metal/mime_responds.rb:239:in `respond_with'
inherited_resources (1.6.0) lib/inherited_resources/actions.rb:7:in `index'
activeadmin (0.6.0) lib/active_admin/resource_controller/actions.rb:11:in `index'
actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.8) lib/active_support/callbacks.rb:447:in `_run__3132776511639953020__process_action__4039445807958643972__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `call'

 

原文地址:https://www.cnblogs.com/chenzhenzhen/p/5289378.html