1

I'm encountering the following error when i try to run a dynamic web page for practice:

TypeError: Object doesn't support this property or method

Extracted source (around line #7):
  <%= csrf_meta_tags %>

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

I get this on my prompt as well:

Started GET "/example/test" for 127.0.0.1 at 2017-06-01 13:00:03 -0500
Processing by ExampleController#test as HTML
  Rendering example/test.html.erb within layouts/application
  Rendered example/test.html.erb within layouts/application (4.5ms)
Completed 500 Internal Server Error in 1984ms

ActionView::Template::Error (TypeError: Object doesn't support this property or method):
    4:     <title>Demoproject</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:

test.html.erb

<h1>Dynamic Web Page Using ERB</h1>
<% sum = 0 %>
<% for i in 1..5 %>
<%= "#{i}" %>
<% sum = sum + i %>
<% end %>
<p>The sum is:
<%= "#{sum}" %>
</p>

application.css:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

example_controller.rb

 class ExampleController < ApplicationController

      def test

      end

    end

application_controller.rb

class ApplicationController < ActionController::Base
      protect_from_forgery with: :exception
    end

Versions: ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32] Rails 5.1.1

I'm using Win10. Can anyone please help?

Felix
  • 11
  • 2

0 Answers0