Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ActionView::Template::Error on Rails 6 #69

Open
DanTaiko opened this issue May 4, 2020 · 3 comments
Open

ActionView::Template::Error on Rails 6 #69

DanTaiko opened this issue May 4, 2020 · 3 comments

Comments

@DanTaiko
Copy link

DanTaiko commented May 4, 2020

I've got a Rails 6 app installed from the box, setup the gem and getting an error on the tree saving.

SEE THE FIX IN THE COMMENT BELOW.

Environment

  • Rails: 6.0.2.2
  • Ruby: 2.7.1

Gem versions

  • ancestry (3.0.7)
  • rails_admin (2.0.2)
  • rails_admin_nestable (0.3.2)

Error

ActionView::Template::Error (undefined method `map' for nil:NilClass):
     8:   .form-group
     9:     #tree_nodes.dd{ data: { update_path: nestable_path(model_name: @abstract_model), max_depth: tree_max_depth } }
    10:       %ol.dd-list
    11:         = nested_tree_nodes @tree_nodes
    12:   - if @options[:live_update] != :only
    13:     .form-group
    14:       %button.btn.btn-primary{ type: 'submit' }= t('admin.actions.nestable.update')

rails_admin_nestable (0.3.2) lib/rails_admin_nestable/helper.rb:4:in `nested_tree_nodes'
rails_admin_nestable (0.3.2) app/views/rails_admin/main/nestable.html.haml:11

Framework Trace

actionview (6.0.2.2) lib/action_view/base.rb:274:in `_run'
actionview (6.0.2.2) lib/action_view/template.rb:185:in `block in render'
activesupport (6.0.2.2) lib/active_support/notifications.rb:182:in `instrument'
actionview (6.0.2.2) lib/action_view/template.rb:386:in `instrument_render_template'
actionview (6.0.2.2) lib/action_view/template.rb:183:in `render'
actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:59:in `block (2 levels) in render_template'
actionview (6.0.2.2) lib/action_view/renderer/abstract_renderer.rb:89:in `block in instrument'
activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `block in instrument'
activesupport (6.0.2.2) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `instrument'
actionview (6.0.2.2) lib/action_view/renderer/abstract_renderer.rb:88:in `instrument'
actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:58:in `block in render_template'
actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:66:in `render_with_layout'
actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:57:in `render_template'
actionview (6.0.2.2) lib/action_view/renderer/template_renderer.rb:13:in `render'
actionview (6.0.2.2) lib/action_view/renderer/renderer.rb:61:in `render_template_to_object'
actionview (6.0.2.2) lib/action_view/renderer/renderer.rb:29:in `render_to_object'
actionview (6.0.2.2) lib/action_view/rendering.rb:118:in `block in _render_template'
actionview (6.0.2.2) lib/action_view/base.rb:304:in `in_rendering_context'
actionview (6.0.2.2) lib/action_view/rendering.rb:117:in `_render_template'
actionpack (6.0.2.2) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionview (6.0.2.2) lib/action_view/rendering.rb:103:in `render_to_body'
actionpack (6.0.2.2) lib/action_controller/metal/rendering.rb:52:in `render_to_body'
actionpack (6.0.2.2) lib/action_controller/metal/renderers.rb:142:in `render_to_body'
actionpack (6.0.2.2) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (6.0.2.2) lib/action_controller/metal/rendering.rb:36:in `render'
actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (6.0.2.2) lib/active_support/core_ext/benchmark.rb:14:in `block in ms'
/home/webadmin/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/benchmark.rb:308:in `realtime'
activesupport (6.0.2.2) lib/active_support/core_ext/benchmark.rb:14:in `ms'
actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:85:in `cleanup_view_runtime'
activerecord (6.0.2.2) lib/active_record/railties/controller_runtime.rb:34:in `cleanup_view_runtime'
actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:43:in `render'
remotipart (1.4.4) lib/remotipart/render_overrides.rb:23:in `render'
rails_admin_nestable (0.3.2) lib/rails_admin_nestable/nestable.rb:66:in `block (2 levels) in <class:Nestable>'
rails_admin (2.0.2) app/controllers/rails_admin/main_controller.rb:22:in `instance_eval'
rails_admin (2.0.2) app/controllers/rails_admin/main_controller.rb:22:in `nestable'
actionpack (6.0.2.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
actionpack (6.0.2.2) lib/abstract_controller/base.rb:196:in `process_action'
actionpack (6.0.2.2) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (6.0.2.2) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
activesupport (6.0.2.2) lib/active_support/callbacks.rb:135:in `run_callbacks'
actionpack (6.0.2.2) lib/abstract_controller/callbacks.rb:41:in `process_action'
actionpack (6.0.2.2) lib/action_controller/metal/rescue.rb:22:in `process_action'
actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `block in instrument'
activesupport (6.0.2.2) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
activesupport (6.0.2.2) lib/active_support/notifications.rb:180:in `instrument'
actionpack (6.0.2.2) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
actionpack (6.0.2.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (6.0.2.2) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
actionpack (6.0.2.2) lib/abstract_controller/base.rb:136:in `process'
actionview (6.0.2.2) lib/action_view/rendering.rb:39:in `process'
actionpack (6.0.2.2) lib/action_controller/metal.rb:191:in `dispatch'
actionpack (6.0.2.2) lib/action_controller/metal.rb:252:in `dispatch'
actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:51:in `dispatch'
actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:33:in `serve'
actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:49:in `block in serve'
actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:837:in `call'
railties (6.0.2.2) lib/rails/engine.rb:526:in `call'
railties (6.0.2.2) lib/rails/railtie.rb:190:in `public_send'
railties (6.0.2.2) lib/rails/railtie.rb:190:in `method_missing'
actionpack (6.0.2.2) lib/action_dispatch/routing/mapper.rb:19:in `block in <class:Constraints>'
actionpack (6.0.2.2) lib/action_dispatch/routing/mapper.rb:48:in `serve'
actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:49:in `block in serve'
actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `each'
actionpack (6.0.2.2) lib/action_dispatch/journey/router.rb:32:in `serve'
actionpack (6.0.2.2) lib/action_dispatch/routing/route_set.rb:837:in `call'
rack-pjax (1.1.0) lib/rack/pjax.rb:12:in `call'
remotipart (1.4.4) lib/remotipart/middleware.rb:32:in `call'
rack (2.2.2) lib/rack/tempfile_reaper.rb:15:in `call'
rack (2.2.2) lib/rack/etag.rb:27:in `call'
rack (2.2.2) lib/rack/conditional_get.rb:40:in `call'
rack (2.2.2) lib/rack/head.rb:12:in `call'
actionpack (6.0.2.2) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
rack (2.2.2) lib/rack/session/abstract/id.rb:266:in `context'
rack (2.2.2) lib/rack/session/abstract/id.rb:260:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/cookies.rb:648:in `call'
activerecord (6.0.2.2) lib/active_record/migration.rb:567:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
activesupport (6.0.2.2) lib/active_support/callbacks.rb:101:in `run_callbacks'
actionpack (6.0.2.2) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/actionable_exceptions.rb:17:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
web-console (4.0.1) lib/web_console/middleware.rb:132:in `call_app'
web-console (4.0.1) lib/web_console/middleware.rb:19:in `block in call'
web-console (4.0.1) lib/web_console/middleware.rb:17:in `catch'
web-console (4.0.1) lib/web_console/middleware.rb:17:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (6.0.2.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (6.0.2.2) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (6.0.2.2) lib/active_support/tagged_logging.rb:80:in `block in tagged'
activesupport (6.0.2.2) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (6.0.2.2) lib/active_support/tagged_logging.rb:80:in `tagged'
railties (6.0.2.2) lib/rails/rack/logger.rb:26:in `call'
sprockets-rails (3.2.1) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.2.2) lib/rack/method_override.rb:24:in `call'
rack (2.2.2) lib/rack/runtime.rb:22:in `call'
activesupport (6.0.2.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/static.rb:126:in `call'
rack (2.2.2) lib/rack/sendfile.rb:110:in `call'
actionpack (6.0.2.2) lib/action_dispatch/middleware/host_authorization.rb:83:in `call'
webpacker (4.2.2) lib/webpacker/dev_server_proxy.rb:23:in `perform_request'
rack-proxy (0.6.5) lib/rack/proxy.rb:57:in `call'
railties (6.0.2.2) lib/rails/engine.rb:526:in `call'
puma (4.3.3) lib/puma/configuration.rb:228:in `call'
puma (4.3.3) lib/puma/server.rb:682:in `handle_request'
puma (4.3.3) lib/puma/server.rb:472:in `process_client'
puma (4.3.3) lib/puma/server.rb:328:in `block in run'
puma (4.3.3) lib/puma/thread_pool.rb:134:in `block in spawn_thread'
@DanTaiko
Copy link
Author

DanTaiko commented May 4, 2020

The error above is due to the 'render text: message' in the 'lib/rails_admin_nestable/nestable.rb', which is not allowed in the Rails 6.

The non-deprecated way is to use 'render :plain'

Rails Guide on Layouts and Rendering

2.2.5 Rendering Text
You can send plain text - with no markup at all - back to the browser by using the :plain option to render:

render plain: "OK"

Suggested fix

The fix would be to change line 66 in the 'lib/rails_admin_nestable/nestable.rb' to

render plain: message

Good luck with Rails 6.

@barabasicsongor
Copy link

Any news on this? Is this fixed?

@DanTaiko
Copy link
Author

Sorry, I have no idea.

I had made a monkey patch for my own app to overcome this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants