gregletic gregletic - 8 months ago 24
Ruby Question

RoR tutorial (Michael Hartl) URI::InvalidURIError

I am following the RoR tutorial by Michael Hartl. Currently on chapter 3. My problem is that I don't get the view I should've seen at

Instead I'm seeing an

enter image description here

The URL I'm trying to enter is: "localhost:3000/static_pages/help".
The application.html.erb looks like this:

<!DOCTYPE html>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>

<%= yield %>


I'm still a rookie so really don't know what to do.


You have a problem with your app's name. To the right of Rails.root in your image, you can see that your app's name is:


Rails.root is the path to your application's directory, and it's used as the base path for locating all the files in your project.

The Rails.root is used in the url marked bad URI. That url is a file:/// url, i.e. a path on your filesystem, and the error is saying that the url is illegal. The url is illegal because urls can only contain certain characters, and a bracket isn't one of them.

Your web browser is trying to request a css file at that path, but Rails doesn't even bother looking for the file--instead Rails stops when it sees an illegal character in the url and throws an error.