railstutorial/sample_app

ActionView::Template::Error (no implicit conversion of nil into String)

PandaWhisperer opened this issue · 6 comments

Trying to run the sample app, but I'm having several problems.

First, both the json and nokogiri gems don't install cleanly on my machine (Ubuntu 16.04). However, this could be fixed by running bundle update json nokogiri which installs newer versions.

After running rake db:setup, I can now boot the server, however, when visiting localhost:3000 in my browser, I get the following error which I can't figure out:

Started GET "/" for 127.0.0.1 at 2016-07-20 16:10:22 +0300
  Processing by PagesController#home as HTML
  SQL (0.2ms)   SELECT name
 FROM sqlite_master
 WHERE type = 'table' AND NOT name = 'sqlite_sequence'

  User Load (0.1ms)  SELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1
  CACHE (0.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" IS NULL LIMIT 1
Rendered layouts/_stylesheets.html.erb (6.5ms)
Rendered pages/home.html.erb within layouts/application (10.5ms)
Completed 500 Internal Server Error in 52ms

ActionView::Template::Error (no implicit conversion of nil into String):
    1: <!--[if lt IE 9]>
    2: <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
    3: <![endif]-->
    4: <%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %>
    5: <%= stylesheet_link_tag 'blueprint/print',  :media => 'print' %>
    6: <!--[if lt IE 8]><%= stylesheet_link_tag 'blueprint/ie' %><![endif]-->
    7: <%= stylesheet_link_tag 'custom', :media => 'screen' %>
  app/views/layouts/_stylesheets.html.erb:4:in `_app_views_layouts__stylesheets_html_erb___3765224715511223535_47141299130920_2224696984243359482'
  app/views/layouts/application.html.erb:6:in `_app_views_layouts_application_html_erb___916573377981086590_47141299334460__2875086869258066459'

Rendered /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.0.12/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.3ms)
Rendered /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.0.12/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (3.1ms)
Rendered /usr/local/opt/rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-3.0.12/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (7.7ms)

Not sure how the line <%= stylesheet_link_tag 'blueprint/screen', :media => 'screen' %> could be trying to convert nil into a String, since there are only constants here.

This version of the sample app is incredibly old. Are you sure you don't want to use a more up-to-date version? See the help page for details.

Yes, I noticed. THB I was just looking for a sample Ruby on Rails app to show someone what it might look like, so I googled "sample rails app" and this was the first result.

Maybe you could update the README with a notice saying that this repo is outdated and link to the current version?

Appreciate the explanation. And updating the README sounds like a good idea. Thanks!

Mirv commented

Is there any chance you can link to the most recent version of github files? The ones I view on here are 3 years old, which is younger than this repo - but still unsure if that's actually the most current or not ...

I've updated the README with a pointer to the most recent sample app. See here for details.

Mirv commented

Found the other link - thank you - had not seen it initially & I understand why you didn't directly comment on it specifically.