ActionView :: Template ::不支持错误对象

时间:2016-09-06 17:30:18

标签: ruby-on-rails ruby actionview

我一直在努力寻找这个问题的答案,显然我还没有完成。我尝试编写我的第一个小编码,我可以打开服务器没有问题,但是当我打开它,但是告诉我显示我编码的内容时,服务器告诉我: TypeError:Object不支持此属性或方法 提取的来源(第7行):

    CTYPE html>
<html>
  <head>
    <title>Programar101</title>
    <%= csrf_meta_tags %>

    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
  </head>

  <body>
    <%= yield %>
  </body>
</html>

在我的命令提示符中,当错误发生时,它给了我:

ActionView::Template::Error (TypeError: Object doesn't support this property or method):
    4:     <title>APP</title>
    5:     <%= csrf_meta_tags %>
    6:
    7:     <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
    8:     <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
    9:   </head>
   10:

app/views/layouts/application.html.erb:7:in `_app_views_layouts_application_html_erb__332994069_78270120'
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_source.html.erb (60.1ms)
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (32.6ms)
  Rendering C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (3.0ms)
  Rendered C:/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/actionpack-5.0.0.1/lib/action_dispatch/middleware/templates/rescues/template_error.html.erb within rescues/layout (5146.8ms)

提前谢谢

2 个答案:

答案 0 :(得分:1)

我认为SO post有一些很好的细节来理解这个问题。我有确切的问题,并遵循堆栈跟踪,似乎原因来自Intent send_report = new Intent(Intent.ACTION_SEND); send_report.putExtra(Intent.EXTRA_EMAIL, new String[]{ email_emailid}); send_report.putExtra(Intent.EXTRA_SUBJECT, email_subject); send_report.putExtra(Intent.EXTRA_STREAM, imageuri); send_report.putExtra(Intent.EXTRA_TEXT, email_body); send_report.setType("text/plain"); send_report.setType("image/png"); startActivityForResult(Intent.createChooser(send_report, "Choose an Email client"), 77); 。但不同的是,更改execjs并不能解决问题。删除runtimes.rb确实会解决,但这不是正确的解决方案,因为它是快速修复。

一个有效的解决方案是安装Node和我have heard这解决了这个问题。我可以确认这解决了我的问题。我认为它与//= require_tree .文件有关,以及Windows上的默认JS环境如何糟糕。

答案 1 :(得分:-2)

您需要在第6行和第7行将“应用”更改为“默认”。

<%= stylesheet_link_tag 'default', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'default', 'data-turbolinks-track': 'reload' %>