mardi 12 janvier 2016

Ruby on Rails: localhost:3000/my_pages_dont_show_up

When I 'rails server' the localhost:3000 works in my browser (chrome). Here's the term:

tom@toms-ubuntu:~/rails_projects/routesapp$ rails s
=> Booting WEBrick
=> Rails 3.2.16 application starting in development on http://localhost:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2016-01-12 10:56:27] INFO  WEBrick 1.3.1
[2016-01-12 10:56:27] INFO  ruby 1.9.3 (2013-11-22) [x86_64-linux]
[2016-01-12 10:56:27] INFO  WEBrick::HTTPServer#start: pid=4751 port=3000

But for localhost:3000/page/home the browser displays:

NoMethodError in Page#home

Showing /home/tom/rails_projects/routesapp/app/views/layouts/application.html.erb where line #5 raised:

undefined method `[]' for nil:NilClass
Extracted source (around line #5):

2: <html>
3: <head>
4:   <title>Routesapp</title>
5:   <%= stylesheet_link_tag    "application", :media => "all" %>
6:   <%= javascript_include_tag "application" %>
7:   <%= csrf_meta_tags %>
8: </head>

Rails.root: /home/tom/rails_projects/routesapp

Application Trace | Framework Trace | Full Trace app/views/layouts/application.html.erb:5:in `_app_views_layouts_application_html_erb___1001173571477850876_70164200470120'

I generated the html files shown in the routes.rb file below; the html files are located in app/views/page

Routesapp::Application.routes.draw do
  get 'page/home'

  get 'page/about'

  get 'page/contact'

Any ideas, comments, suggestions will be much appreciated. This is new to me. Thanks

Aucun commentaire:

Enregistrer un commentaire