admin
发布于 2024-11-07 / 18 阅读
0
0

【rails】配置 devise+cancan+rolily配置用户认证和管理页面无法打开

app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__201193244_46217712'

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (7.8ms)

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb(4.9ms)

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (534.2ms)

Started GET "/home/index" for 127.0.0.1 at 2017-03-13 12:02:25 +0800

Processing by HomeController#index as HTML

  Rendering home/index.html.erb within layouts/application

  Rendered home/index.html.erb within layouts/application (0.0ms)

Completed 500 Internal Server Error in 130ms (ActiveRecord: 0.0ms)

ActionView::Template::Error (TypeError: 对象不支持此属性或方法):

    4:     <title>CfgRecorder</title>

    5:     <%= csrf_meta_tags %>

    6:

    7:     <%= stylesheet_link_tag    'application', media: 'all', 'data-turboli

nks-track': 'reload' %>

    8:     <%= javascript_include_tag 'application', 'data-turbolinks-track': 'r

eload' %>

    9:   </head>

   10:

app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__201193244_50144112'

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (7.8ms)

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (5.9ms)

  Rendering E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (1.0ms)

  Rendered E:/RailsInstaller/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack5.0.2/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (562.5ms)

办法一: 将javascript_include_tag 'application'改成javascript_include_tag 'defaults',此方法已验证,暂时运行没问题,但在用到delete时,会失败。

办法二: 安装node.js,此方法试过了,没有成功,现在试其它版本的

办法三: 在../app/assets/javascripts/application.js中,删除 //= require turbolinks //= require_tree . 两行,此法可以解决,具体原理不是太明白,有明白的大神,还请指教一二,多谢!

关于turbolinks的应用可以参见:http://chloerei.com/2013/07/14/turbolinks-guide/


评论