0

我已经添加了gem rails_admin. 起初它运行良好,但每当我想编辑或查找某些内容时,就会出现此问题。我试图删除该行,但找不到它在应用程序中的位置。我读到很多人遇到了与我类似的问题,但对我没有任何帮助!此外,由于我的应用程序使用不同的语言,出于某种原因,我认为这可能是它无法运行的原因。似乎没有人知道问题所在

这是我得到的:

 uninitialized constant User::Like Extracted source (around line #158): end 
raise NameError.new("uninitialized constant #{candidates.first}", candidates.first) end 
end

这是一个完整的跟踪:

Trace of template inclusion: /usr/local/rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.1/app/views/rails_admin/main/new.html.haml Rails.root: /home/ubuntu/workspace Application Trace | Framework Trace | Full Trace activerecord (4.2.5) lib/active_record/inheritance.rb:158:in `compute_type' activerecord (4.2.5) lib/active_record/reflection.rb:295:in `compute_class' activerecord (4.2.5) lib/active_record/reflection.rb:291:in `klass' activerecord (4.2.5) lib/active_record/reflection.rb:671:in `source_reflection' activerecord (4.2.5) lib/active_record/reflection.rb:640:in `foreign_key' rails_admin (1.1.1) lib/rails_admin/adapters/active_record/association.rb:37:in `foreign_key' rails_admin (1.1.1) lib/rails_admin/config/fields/factories/association.rb:6:in `block (2 levels) in <top (required)>' rails_admin (1.1.1) lib/rails_admin/config/fields/factories/association.rb:6:in `each' rails_admin (1.1.1) lib/rails_admin/config/fields/factories/association.rb:6:in `detect' rails_admin (1.1.1) lib/rails_admin/config/fields/factories/association.rb:6:in `block in <top (required)>' rails_admin (1.1.1) lib/rails_admin/config/fields.rb:54:in `block (2 levels) in factory' rails_admin (1.1.1) lib/rails_admin/config/fields.rb:54:in `each' rails_admin (1.1.1) lib/rails_admin/config/fields.rb:54:in `detect' rails_admin (1.1.1) lib/rails_admin/config/fields.rb:54:in `block in factory' rails_admin (1.1.1) lib/rails_admin/config/fields.rb:50:in `each' rails_admin (1.1.1) lib/rails_admin/config/fields.rb:50:in `factory' rails_admin (1.1.1) lib/rails_admin/config/has_fields.rb:130:in `_fields' rails_admin (1.1.1) lib/rails_admin/config/has_fields.rb:133:in `_fields' rails_admin (1.1.1) lib/rails_admin/config/has_fields.rb:108:in `all_fields' rails_admin (1.1.1) lib/rails_admin/config/has_fields.rb:83:in `fields' rails_admin (1.1.1) app/controllers/rails_admin/main_controller.rb:123:in `get_collection' rails_admin (1.1.1) app/controllers/rails_admin/main_controller.rb:37:in `list_entries' rails_admin (1.1.1) app/views/rails_admin/main/_form_filtering_select.html.haml:20:in `__usr_local_rvm_gems_ruby_______gems_rails_admin_______app_views_rails_admin_main__form_filtering_select_html_haml__2345908052801766424_70236212464320' actionview (4.2.5) lib/action_view/template.rb:145:in `block in render' activesupport (4.2.5) lib/active_support/notifications.rb:166:in `instrument' actionview (4.2.5) lib/action_view/template.rb:333:in `instrument' actionview (4.2.5) lib/action_view/template.rb:143:in `render' actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:339:in `render_partial' actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:310:in `block in render' actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument' activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument' actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument' actionview (4.2.5) lib/action_view/renderer/partial_renderer.rb:309:in `render' actionview (4.2.5) lib/action_view/renderer/renderer.rb:47:in `render_partial' actionview (4.2.5) lib/action_view/renderer/renderer.rb:21:in `render' actionview (4.2.5) lib/action_view/helpers/rendering_helper.rb:32:in `render' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:10:in `block in render_with_haml' haml (4.0.7) lib/haml/helpers.rb:89:in `non_haml' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:10:in `render_with_haml' rails_admin (1.1.1) lib/rails_admin/config/fields/base.rb:227:in `block in <class:Base>' rails_admin (1.1.1) lib/rails_admin/config/configurable.rb:66:in `instance_eval' rails_admin (1.1.1) lib/rails_admin/config/configurable.rb:66:in `block in register_instance_option' rails_admin (1.1.1) lib/rails_admin/config/proxyable/proxy.rb:27:in `method_missing' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:73:in `field_for' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:58:in `block in input_for' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer' haml (4.0.7) lib/haml/helpers/action_view_xss_mods.rb:5:in `with_output_buffer_with_haml_xss' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `capture' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:52:in `capture_with_haml' actionview (4.2.5) lib/action_view/helpers/tag_helper.rb:106:in `content_tag' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:69:in `content_tag_with_haml' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:57:in `input_for' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:46:in `block in field_wrapper_for' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer' haml (4.0.7) lib/haml/helpers/action_view_xss_mods.rb:5:in `with_output_buffer_with_haml_xss' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `capture' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:52:in `capture_with_haml' actionview (4.2.5) lib/action_view/helpers/tag_helper.rb:106:in `content_tag' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:69:in `content_tag_with_haml' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:44:in `field_wrapper_for' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:35:in `block (2 levels) in fieldset_for' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:35:in `collect' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:35:in `block in fieldset_for' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer' haml (4.0.7) lib/haml/helpers/action_view_xss_mods.rb:5:in `with_output_buffer_with_haml_xss' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `capture' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:52:in `capture_with_haml' actionview (4.2.5) lib/action_view/helpers/tag_helper.rb:106:in `content_tag' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:69:in `content_tag_with_haml' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:31:in `fieldset_for' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:16:in `block (2 levels) in generate' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:15:in `collect' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:15:in `block in generate' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:131:in `without_field_error_proc_added_div' rails_admin (1.1.1) app/helpers/rails_admin/form_builder.rb:7:in `generate' rails_admin (1.1.1) app/views/rails_admin/main/new.html.haml:2:in `block in __usr_local_rvm_gems_ruby_______gems_rails_admin_______app_views_rails_admin_main_new_html_haml__2436263065298238128_70236469416200' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:137:in `block (2 levels) in form_for_with_haml' haml (4.0.7) lib/haml/helpers.rb:278:in `with_tabs' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:137:in `block in form_for_with_haml' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `block in capture' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:202:in `with_output_buffer' haml (4.0.7) lib/haml/helpers/action_view_xss_mods.rb:5:in `with_output_buffer_with_haml_xss' actionview (4.2.5) lib/action_view/helpers/capture_helper.rb:38:in `capture' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:52:in `capture_with_haml' actionview (4.2.5) lib/action_view/helpers/form_helper.rb:444:in `form_for' haml (4.0.7) lib/haml/helpers/action_view_mods.rb:139:in `form_for_with_haml' haml (4.0.7) lib/haml/helpers/action_view_xss_mods.rb:28:in `form_for_with_haml_xss' rails_admin (1.1.1) app/helpers/rails_admin/main_helper.rb:9:in `rails_admin_form_for' rails_admin (1.1.1) app/views/rails_admin/main/new.html.haml:1:in `__usr_local_rvm_gems_ruby_______gems_rails_admin_______app_views_rails_admin_main_new_html_haml__2436263065298238128_70236469416200' actionview (4.2.5) lib/action_view/template.rb:145:in `block in render' activesupport (4.2.5) lib/active_support/notifications.rb:166:in `instrument' actionview (4.2.5) lib/action_view/template.rb:333:in `instrument' actionview (4.2.5) lib/action_view/template.rb:143:in `render' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template' actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument' activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument' actionview (4.2.5) lib/action_view/renderer/abstract_renderer.rb:39:in `instrument' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:53:in `block in render_template' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:52:in `render_template' actionview (4.2.5) lib/action_view/renderer/template_renderer.rb:14:in `render' actionview (4.2.5) lib/action_view/renderer/renderer.rb:42:in `render_template' actionview (4.2.5) lib/action_view/renderer/renderer.rb:23:in `render' actionview (4.2.5) lib/action_view/rendering.rb:100:in `_render_template' actionpack (4.2.5) lib/action_controller/metal/streaming.rb:217:in `_render_template' actionview (4.2.5) lib/action_view/rendering.rb:83:in `render_to_body' actionpack (4.2.5) lib/action_controller/metal/rendering.rb:32:in `render_to_body' actionpack (4.2.5) lib/action_controller/metal/renderers.rb:37:in `render_to_body' actionpack (4.2.5) lib/abstract_controller/rendering.rb:25:in `render' actionpack (4.2.5) lib/action_controller/metal/rendering.rb:16:in `render' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render' activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `block in ms' /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/benchmark.rb:308:in `realtime' activesupport (4.2.5) lib/active_support/core_ext/benchmark.rb:12:in `ms' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:44:in `block in render' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime' activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:43:in `render' remotipart (1.3.1) lib/remotipart/render_overrides.rb:16:in `render_with_remotipart' rails_admin (1.1.1) lib/rails_admin/config/actions/new.rb:28:in `block (4 levels) in <class:New>' actionpack (4.2.5) lib/action_controller/metal/mime_responds.rb:217:in `respond_to' rails_admin (1.1.1) lib/rails_admin/config/actions/new.rb:27:in `block (2 levels) in <class:New>' rails_admin (1.1.1) app/controllers/rails_admin/main_controller.rb:22:in `instance_eval' rails_admin (1.1.1) app/controllers/rails_admin/main_controller.rb:22:in `new' actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (4.2.5) lib/abstract_controller/base.rb:198:in `process_action' actionpack (4.2.5) lib/action_controller/metal/rendering.rb:10:in `process_action' actionpack (4.2.5) lib/abstract_controller/callbacks.rb:20:in `block in process_action' activesupport (4.2.5) lib/active_support/callbacks.rb:117:in `call' activesupport (4.2.5) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile' activesupport (4.2.5) lib/active_support/callbacks.rb:505:in `call' activesupport (4.2.5) lib/active_support/callbacks.rb:92:in `__run_callbacks__' activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks' activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks' actionpack (4.2.5) lib/abstract_controller/callbacks.rb:19:in `process_action' actionpack (4.2.5) lib/action_controller/metal/rescue.rb:29:in `process_action' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `block in instrument' activesupport (4.2.5) lib/active_support/notifications/instrumenter.rb:20:in `instrument' activesupport (4.2.5) lib/active_support/notifications.rb:164:in `instrument' actionpack (4.2.5) lib/action_controller/metal/instrumentation.rb:30:in `process_action' actionpack (4.2.5) lib/action_controller/metal/params_wrapper.rb:250:in `process_action' activerecord (4.2.5) lib/active_record/railties/controller_runtime.rb:18:in `process_action' actionpack (4.2.5) lib/abstract_controller/base.rb:137:in `process' actionview (4.2.5) lib/action_view/rendering.rb:30:in `process' actionpack (4.2.5) lib/action_controller/metal.rb:196:in `dispatch' actionpack (4.2.5) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch' actionpack (4.2.5) lib/action_controller/metal.rb:237:in `block in action' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:76:in `dispatch' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:45:in `serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call' railties (4.2.5) lib/rails/engine.rb:518:in `call' railties (4.2.5) lib/rails/railtie.rb:194:in `public_send' railties (4.2.5) lib/rails/railtie.rb:194:in `method_missing' actionpack (4.2.5) lib/action_dispatch/routing/mapper.rb:51:in `serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:43:in `block in serve' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `each' actionpack (4.2.5) lib/action_dispatch/journey/router.rb:30:in `serve' actionpack (4.2.5) lib/action_dispatch/routing/route_set.rb:817:in `call' rack-pjax (1.0.0) lib/rack/pjax.rb:12:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/flash.rb:260:in `call' warden (1.2.6) lib/warden/manager.rb:35:in `block in call' warden (1.2.6) lib/warden/manager.rb:34:in `catch' warden (1.2.6) lib/warden/manager.rb:34:in `call' rack (1.6.4) lib/rack/etag.rb:24:in `call' rack (1.6.4) lib/rack/conditionalget.rb:25:in `call' rack (1.6.4) lib/rack/head.rb:13:in `call' remotipart (1.3.1) lib/remotipart/middleware.rb:32:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/params_parser.rb:27:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/flash.rb:260:in `call' rack (1.6.4) lib/rack/session/abstract/id.rb:225:in `context' rack (1.6.4) lib/rack/session/abstract/id.rb:220:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/cookies.rb:560:in `call' activerecord (4.2.5) lib/active_record/query_cache.rb:36:in `call' activerecord (4.2.5) lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call' activerecord (4.2.5) lib/active_record/migration.rb:377:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call' activesupport (4.2.5) lib/active_support/callbacks.rb:88:in `__run_callbacks__' activesupport (4.2.5) lib/active_support/callbacks.rb:778:in `_run_call_callbacks' activesupport (4.2.5) lib/active_support/callbacks.rb:81:in `run_callbacks' actionpack (4.2.5) lib/action_dispatch/middleware/callbacks.rb:27:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/reloader.rb:73:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/remote_ip.rb:78:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call' web-console (2.3.0) lib/web_console/middleware.rb:20:in `block in call' web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch' web-console (2.3.0) lib/web_console/middleware.rb:18:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call' railties (4.2.5) lib/rails/rack/logger.rb:38:in `call_app' railties (4.2.5) lib/rails/rack/logger.rb:20:in `block in call' activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `block in tagged' activesupport (4.2.5) lib/active_support/tagged_logging.rb:26:in `tagged' activesupport (4.2.5) lib/active_support/tagged_logging.rb:68:in `tagged' railties (4.2.5) lib/rails/rack/logger.rb:20:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/request_id.rb:21:in `call' rack (1.6.4) lib/rack/methodoverride.rb:22:in `call' rack (1.6.4) lib/rack/runtime.rb:18:in `call' activesupport (4.2.5) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call' rack (1.6.4) lib/rack/lock.rb:17:in `call' actionpack (4.2.5) lib/action_dispatch/middleware/static.rb:116:in `call' rack (1.6.4) lib/rack/sendfile.rb:113:in `call' railties (4.2.5) lib/rails/engine.rb:518:in `call' railties (4.2.5) lib/rails/application.rb:165:in `call' rack (1.6.4) lib/rack/lock.rb:17:in `call' rack (1.6.4) lib/rack/content_length.rb:15:in `call' rack (1.6.4) lib/rack/handler/webrick.rb:88:in `service' /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service' /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run' /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'`

我还想知道我是否可以仅生成仅使用英语作为 gem 路线的区域设置语言的 gem,而不是应用程序的区域设置语言!

请帮忙,提前谢谢!

4

1 回答 1

1

我今天在尝试命名模型时遇到了这个问题,发现应该归咎于基本的搜索过滤器;

一旦我添加了一个新的过滤器,问题就解决了。我相信原因是,一旦我添加了一个过滤器,所有预填充的活动管理员过滤器都消失了,包括那些导致我这个问题的过滤器。

在您的页面上创建一个新的过滤器简单类型

filter :foo

我希望这会有用。

于 2017-04-04T14:54:13.407 回答