willy_wang
(willy wang)
December 27, 2015, 2:55am
1
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 .
willy_wang
(willy wang)
December 28, 2015, 8:21am
3
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’
gem ‘therubyracer’, platforms: :ruby
Use jquery as the JavaScript library
gem ‘jquery-rails’
gem ‘turbolinks’
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]
Colin_Law
(Colin Law)
December 28, 2015, 8:34am
4
What happens if you open localhost:3000
Colin
willy_wang
(willy wang)
December 28, 2015, 8:38am
5
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
Colin_Law
(Colin Law)
December 28, 2015, 8:42am
6
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
willy_wang
(willy wang)
December 28, 2015, 9:13am
7
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
Colin_Law
(Colin Law)
December 28, 2015, 9:23am
8
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
willy_wang
(willy wang)
December 28, 2015, 9:29am
9
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
willy_wang
(willy wang)
December 28, 2015, 9:37am
10
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 : Basic Hello, Rails! not working - Stack Overflow
thanks pal
but did u know why must delete the js script ?
Colin_Law
(Colin Law)
December 28, 2015, 10:04am
11
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