ask ruby LOCALHOST

Routing Error

hello there,
im willy, i just trying use ruby for first time
a have problem when i make directory,

i follow the video tutor from M. Hartl , i can open the localhost:3000
but when i go deeper and make directory D:\RailsInstaller\toy_app\app\views\users

i open localhost:3000/users and show like this

No route matches [GET] “/Users”

Rails.root: D:/RailsInstaller/toy_app

``

any advice ?

sry bad english

It looks like you created a view folder but do not have a controller action or route to match. You’ll want to setup a route on config/routes.rb to match a controller action. The tutorial should walk you through this but you can also see the routing guide in the rails guides on rubyonrails.org.

hai , when i wanna open localhost:3000/toy_app
show like this

its my routes
Rails.application.routes.draw do
get ‘toyapp/index’

resources :users

it’s my toyapp_controller
class ToyappController < ApplicationController
def index
end
end

gem file
source ‘https://rubygems.org

Bundle edge Rails instead: gem ‘rails’, github: ‘rails/rails’

gem ‘rails’, ‘4.2.5’

Use sqlite3 as the database for Active Record

gem ‘sqlite3’

Use SCSS for stylesheets

gem ‘sass-rails’, ‘~> 5.0’

Use Uglifier as compressor for JavaScript assets

gem ‘uglifier’, ‘>= 1.3.0’

Use CoffeeScript for .coffee assets and views

gem ‘coffee-rails’, ‘~> 4.1.0’

See https://github.com/rails/execjs#readme for more supported runtimes

gem ‘therubyracer’, platforms: :ruby

Use jquery as the JavaScript library

gem ‘jquery-rails’

Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks

gem ‘turbolinks’

Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

gem ‘jbuilder’, ‘~> 2.0’

bundle exec rake doc:rails generates the API under doc/api.

gem ‘sdoc’, ‘~> 0.4.0’, group: :doc

Use ActiveModel has_secure_password

gem ‘bcrypt’, ‘~> 3.1.7’

Use Unicorn as the app server

gem ‘unicorn’

Use Capistrano for deployment

gem ‘capistrano-rails’, group: :development

group :development, :test do

Call ‘byebug’ anywhere in the code to stop execution and get a debugger console

gem ‘byebug’
end

group :development do

Access an IRB console on exception pages or by using <%= console %> in views

gem ‘web-console’, ‘~> 2.0’
end

Windows does not include zoneinfo files, so bundle the tzinfo-data gem

gem ‘tzinfo-data’, platforms: [:mingw, :mswin, :x64_mingw, :jruby]

What happens if you open localhost:3000

Colin

Hello Colin

its show ruby welcome aboard

Welcome aboard
You’re riding Ruby on Rails!
About your application’s environment

i’m using windows 7,

W.Wang

When you run rails s it starts the server for the app in that folder,
so the welcome aboard page is coming from that app.

Colin

yes it working when i wanna just localhost:3000
but when i wanna open dir app …app/view/users

thats gonna show

Showing D:/RailsInstaller/toy_app/app/views/layouts/application.html.erb where line #5 raised:

TypeError: Object doesn’t support this property or method

Rails.root: D:/RailsInstaller/toy_app

any advice ?

i follow the instruction ruby on capter toyapp

Which version of rail (rails -v) and ruby (ruby -v) are you using and
which versions does the tutorial expect?

Also copy/paste the offending file
(app/views/layouts/application.html.erb) here.

Colin

rails version 4.2.5
ruby version 2.1.5p273 (2014-11-13 revision 48405)
tutorial suggest rails v is 4.2.0

here the app/views/layouts/application.html.erb

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

<%= yield %>

</body>
</html>

Kindly regards
Willy Wang

hai Colin

it's can be work now, with remove the JS script

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

scourge : http://stackoverflow.com/questions/20751397/basic-hello-rails-not-working

thanks pal

but did u know why must delete the js script ?

In the stackoverflow question it says the error is in
welcome.js.coffee which you did not tell us here (assuming your error
was the same). The suggestion there is that it is a windows issue, in
which case definitely the best thing is to switch to a linux
distribution such as Ubuntu. Very few developers use Windows for
Rails and you will find it difficult to get help.

You might like to try the railstutorial.org tutorial (which is free to
use online) as it will run in the cloud and does not need you to
install anything. Then when you have done that you will have a better
idea of the issues.

Colin