Hello I am new to Ruby on Rails. Here is my Setup on my Windows 10 machine
C:\Users\Jaiel>ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
C:\Users\Jaiel>sqlite3 --version
3.8.7.2 2014-11-18 20:57:56 2ab564bf9655b7c7b97ab85cafc8a48329b27f93
C:\Users\Jaiel>rails --version
Rails 5.1.6
I am following the step by step tutorial form http://guides.rubyonrails.org/getting_started.html but I get an Error
I've run
C:\Users\Jaiel\Desktop\Test>rails new blog
Then I ran
C:\Users\Jaiel\Desktop\Test>cd blog
C:\Users\Jaiel\Desktop\Test\blog>rails server
And opened
http://localhost:3000/
and saw the "Yay, You're on Rails" Webpage
Then Ive ran
C:\Users\Jaiel\Desktop\Test\blog>rails generate controller Welcome index
create app/controllers/welcome_controller.rb
route get 'welcome/index'
invoke erb
create app/views/welcome
create app/views/welcome/index.html.erb
invoke test_unit
create test/controllers/welcome_controller_test.rb
invoke helper
create app/helpers/welcome_helper.rb
invoke test_unit
invoke assets
invoke coffee
create app/assets/javascripts/welcome.coffee
invoke scss
create app/assets/stylesheets/welcome.scss
I opened the
app/views/welcome/index.html.erb
file in my text editor. Deleted all of the existing code in the file, and replaced it with the following single line of code:
<h1>Hello, Rails!</h1>
I then opened the file
config/routes.rb
in my editor and edited it to look like this:
Rails.application.routes.draw do
get 'welcome/index'
root 'welcome#index'
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
end
But now when I start the server
C:\Users\Jaiel\Desktop\Test\blog>rails server
and go to
http://localhost:3000/
Now comes the Error:
in the console and the error page it the says
Started GET "/" for 127.0.0.1 at 2018-04-23 18:05:56 +0200
Processing by WelcomeController#index as HTML
Rendering welcome/index.html.erb within layouts/application
Rendered welcome/index.html.erb within layouts/application (0.5ms)
Completed 500 Internal Server Error in 371ms
ActionView::Template::Error (TypeError: Das Objekt unterstützt diese Eigenschaft oder Methode nicht.):
4: <title>Blog</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__839057971_94964316'
So line 7 gives the Error here :(
The Error is translated from german to
(TypeError: Object doesn't support this property or method)
It is because of the line
root 'welcome#index'
that I added into
C:\Users\Jaiel\Desktop\Test\blog\config\routes.rb
What is wrong here. Its the pofficial guide and the first Hello World Example but its already messed up...
Update: I removed the line
//= require_tree .
from
C:\Users\Jaiel\Desktop\Test\blog\app\assets\javascripts\application.js
and it worked. But this is a ridiculous solution as stated here ExecJS::RuntimeError on Windows trying to follow rubytutorial