activeadmin / activeadmin-mongoid

ActiveAdmin hacks to support Mongoid
MIT License
192 stars 210 forks source link

Error on show view #77

Closed iduuck closed 7 years ago

iduuck commented 10 years ago

Hi there, I got a problem when developing with activeadmin-mongoid. So, everythings fine, but now I wanted to create a new Booking (my model name) and then I got the following error:

[:_id] is not a symbol

I tried to edit, that the _id should not be shown on the show page, but it also does not help.

The entire trace:

/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/view_helpers/display_helper.rb:8:in `block in <module:DisplayHelper>'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/view_helpers/method_or_proc_helper.rb:86:in `instance_exec'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/view_helpers/method_or_proc_helper.rb:86:in `render_in_context'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/view_helpers/display_helper.rb:18:in `display_name'
arbre (1.0.1) lib/arbre/element.rb:175:in `method_missing'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/views/pages/show.rb:36:in `default_title'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/views/pages/show.rb:14:in `title'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/views/pages/base.rb:25:in `block in build_active_admin_head'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:49:in `with_current_arbre_element'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/views/pages/base.rb:24:in `build_active_admin_head'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/lib/active_admin/views/pages/base.rb:9:in `build'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:30:in `block in build_tag'
arbre (1.0.1) lib/arbre/context.rb:92:in `with_current_arbre_element'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:26:in `build_tag'
arbre (1.0.1) lib/arbre/element/builder_methods.rb:39:in `insert_tag'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/app/views/active_admin/resource/show.html.arb:1:in `block in ___sers_dschmidt__rbenv_versions_______p____lib_ruby_gems_______bundler_gems_active_admin_fdc_a_d_faee_app_views_active_admin_resource_show_html_arb___757245983050418369_70286301542840'
arbre (1.0.1) lib/arbre/context.rb:45:in `instance_eval'
arbre (1.0.1) lib/arbre/context.rb:45:in `initialize'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/app/views/active_admin/resource/show.html.arb:1:in `new'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/bundler/gems/active_admin-fdc6a3d9faee/app/views/active_admin/resource/show.html.arb:1:in `___sers_dschmidt__rbenv_versions_______p____lib_ruby_gems_______bundler_gems_active_admin_fdc_a_d_faee_app_views_active_admin_resource_show_html_arb___757245983050418369_70286301542840'
actionview (4.1.0) lib/action_view/template.rb:145:in `block in render'
activesupport (4.1.0) lib/active_support/notifications.rb:161:in `instrument'
actionview (4.1.0) lib/action_view/template.rb:339:in `instrument'
actionview (4.1.0) lib/action_view/template.rb:143:in `render'
actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:55:in `block (2 levels) in render_template'
actionview (4.1.0) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `instrument'
actionview (4.1.0) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:54:in `block in render_template'
actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:62:in `render_with_layout'
actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:53:in `render_template'
actionview (4.1.0) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionview (4.1.0) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionview (4.1.0) lib/action_view/renderer/renderer.rb:23:in `render'
actionview (4.1.0) lib/action_view/rendering.rb:99:in `_render_template'
actionpack (4.1.0) lib/action_controller/metal/streaming.rb:217:in `_render_template'
actionview (4.1.0) lib/action_view/rendering.rb:82:in `render_to_body'
actionpack (4.1.0) lib/action_controller/metal/rendering.rb:32:in `render_to_body'
actionpack (4.1.0) lib/action_controller/metal/renderers.rb:32:in `render_to_body'
actionpack (4.1.0) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.1.0) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.1.0) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (4.1.0) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:40:in `render'
actionpack (4.1.0) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.1.0) lib/action_controller/metal/responder.rb:238:in `default_render'
actionpack (4.1.0) lib/action_controller/metal/responder.rb:165:in `to_html'
responders (1.0.0) lib/responders/flash_responder.rb:104:in `to_html'
actionpack (4.1.0) lib/action_controller/metal/responder.rb:158:in `respond'
actionpack (4.1.0) lib/action_controller/metal/responder.rb:151:in `call'
actionpack (4.1.0) lib/action_controller/metal/mime_responds.rb:400:in `respond_with'
inherited_resources (1.4.1) lib/inherited_resources/actions.rb:13:in `show'
actionpack (4.1.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.1.0) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.1.0) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.1.0) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:113:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:229:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:166:in `block in halting'
activesupport (4.1.0) lib/active_support/callbacks.rb:86:in `call'
activesupport (4.1.0) lib/active_support/callbacks.rb:86:in `run_callbacks'
actionpack (4.1.0) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.1.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.1.0) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.1.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.1.0) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
actionpack (4.1.0) lib/abstract_controller/base.rb:136:in `process'
actionview (4.1.0) lib/action_view/rendering.rb:30:in `process'
actionpack (4.1.0) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.1.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.1.0) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.1.0) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.1.0) lib/action_dispatch/routing/route_set.rb:676:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
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:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/flash.rb:254: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.1.0) lib/action_dispatch/middleware/cookies.rb:560:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.1.0) lib/active_support/callbacks.rb:82:in `run_callbacks'
actionpack (4.1.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.1.0) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.1.0) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.1.0) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.1.0) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.1.0) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.1.0) 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.1.0) lib/active_support/cache/strategy/local_cache_middleware.rb:26:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.1.0) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.1.0) lib/rails/engine.rb:514:in `call'
railties (4.1.0) lib/rails/application.rb:144:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138:in `service'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:94:in `run'
/Users/dschmidt/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/webrick/server.rb:295:in `block in start_thread'
oliviermilla commented 10 years ago

@iDuuck did you find a fix for this? I'm hitting the same thing here.

max-konin commented 10 years ago

@iDuuck try to add following to initializer

module ActiveAdmin
  module ViewHelpers
    module DisplayHelper
      const_set :DISPLAY_NAME_FALLBACK, ->{
        name, klass = "", self.class
        name << klass.model_name.human         if klass.respond_to? :model_name
        name.present? ? name : to_s
      }
    end
  end
end