First of all, I open the Windows command prompt with Ruby and Rails via the shortcut provided by RailsInstaller. First of all, I create a new Ruby on Rails application using the following command. I call it "curso"
rails new curso
After that, I navigate to the project folder C:\Sites\prueba
and start the WEBrick server, like this:
rails s
I go to localhost:3000
and the test page runs perfectly.
After that, I import the project in NetBeans. Then, I open the command prompt and create a new controller, like this:
rails g controller miprueba index
I check the file Views/layouts/application.html.erb
, which was generated by Rails and it looks like this:
<!DOCTYPE html>
<html>
<head>
<title>Prueba</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>
NetBeans shows me an error on line 7. It says Unexpected ':'
. The same error happens in line 8.
If I try running the application, in localhost:3000/miprueba/index
, I get an error page titled "Action Controller: Exception caught". It says this:
ExecJS::ProgramError in Miprueba#index
Showing C:/Sites/prueba/app/views/layouts/application.html.erb where line #7 raised:
TypeError: El objeto no acepta esta propiedad o método
The last line roughly means "The object doesn't accept this value or method".
If I delete lines 7 and 8 the application runs just fine, but I'm curious about why are those two lines generated and why do they fail.