relative paths for accessing rails assets - ruby-on-rails

I'm stuck! xD I've been working on a Rails project and am having trouble accessing my assets using relative paths. A friend of mine is working on the html/css side of things while I'm handling the controllers and models. My friend recently gave me a batch of files structured in the following way:
app/assets/images/*.jpg
app/assets/stylesheets/*.css
app/assets/javascripts/*.js
app/assets/fonts/*.* (+some more css files in here)
Within my app/views/layouts directory, I have a layout named final.html.erb which is used for my entire webapp. I also have 1 page(html body content) that I'm trying to render with this layout in app/views/pages named final_page.html.erb ... the necessary routing is in place for the page to load; however, it only loads the context of the final_page.html.erb (no images, styling, or fonts). When I go to the console and type "rails server" and visit localhost:3000, the page shows up ... naked lol. The console outputs the following:
Started GET "/" for 127.0.0.1 at 2012-07-28 21:15:02 -0700
Connecting to database specified by database.yml
Processing by PagesController#final_page as HTML
Rendered pages/final_page.html.erb within layouts/final (8.4ms)
Completed 200 OK in 82ms (Views: 81.0ms | ActiveRecord: 0.0ms)
Started GET "/assets/stylesheets/style.css" for 127.0.0.1 at 2012-07-28 21:15:04 -0700
ActionController::RoutingError (No route matches [GET] "/assets/stylesheets/style.css"):
actionpack (3.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.6) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.6) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.6) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.6) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.6) lib/rails/engine.rb:479:in `call'
railties (3.2.6) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.6) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Rendered /var/lib/gems/1.9.1/gems/actionpack-3.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (2.0ms)
I think that the problem is that I'm trying to access files using relative paths. My layout file looks like this:
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="viewport" content="width=device-width">
<title>:: Final ::</title>
<link rel="stylesheet" type="text/css" href="../../assets/stylesheets/style.css">
<link href="../../assets/stylesheets/desktop.css" rel="stylesheet" type="text/css" media="only screen and (min-width:769px) and (max-width:1000px)">
<script src="../../assets/javascripts/modernizr.js" type="text/javascript"></script>
</head>
<body>
<%= yield %>
</body>
</html>
Also, within the body of my final_page.html.erb file, I try to access images using relative paths as well...like so:
<img src="../../assets/images/mainImg.jpg" alt="img">
My friend wrote most of this html, and he has 0 experience working with rails. I decided to change the requests for assets like so:
From:
<link rel="stylesheet" type="text/css" href="../../assets/stylesheets/style.css">
To:
<%= stylesheet_link_tag "application.css" %>
From:
<script src="../../assets/javascripts/modernizr.js" type="text/javascript"></script>
To:
<%= javascript_include_tag "application.js" %>
From:
<img src="../../assets/images/mainImg.jpg" alt="img">
To:
<%= image_tag "mainImg.jpg" %>
This somewhat helps, as the images load, and very little of the styling comes through; however, it's way off from what it's supposed to look like. I'm thinking it's because my friend makes relative calls within the css files themselves:
body {
background-image: url(../images/bg.jpg);
background-repeat: repeat;
}
I've tried replacing these with url(<%= asset_path 'bg.jpg' %>) etc...
but it has no effect. I've tried so many things, and have read so many posts. I'm wondering if there's a way that Rails will allow me to use relative paths. I've tried:
config.assets.enabled = false
but that doesn't help ... please ... what am I doing wrong? I don't think my friend will want to stop using relative paths for his work, as it is how he does things. The site fires up well outside of Rails, but I need it to work with Rails for my webapp. Any advice would be greatly appreciated. Thank you for having the patience for reading all of this.
P.S. I'm using Ruby 1.9.3, and Rails 3.2.6

Try to use /assets/style.css not /assets/stylesheets/style.css and so on.
If there is such structure:
app
assets
stylesheets
javascripts
Then to get access to files in app/assets or in app/assets/any_folder you should use path /assets/file.
Updated
Here try:
body {
background-image: url(bg.jpg);
background-repeat: repeat;
}
Or:
body {
background-image: url(/assets/bg.jpg);
background-repeat: repeat;
}

Rails 3.1 introduced the new Asset Pipeline. I would recommend you read over this: http://guides.rubyonrails.org/asset_pipeline.html
In your app/views/layouts/application.html.erb file, make sure you have this:
<%= stylesheet_link_tag "application", :media => "all" %>
In your app/assets/stylesheets/application.css file, make sure you have this line:
*= require_tree .
(This will ensure that any css files that you have in the app/assets/stylesheets directory will be available to your application)
in your css file you can just do this to reference images in your app/assets/images directory:
background-image: url(bg.jpg);

In case you want to use local resources in your configuration initializers and you have this folder structure:
app
assets
stylesheets
javascripts
All you have to do is: (in this sample im using Spree base config/initializer)
Spree.config do |config|
config.admin_interface_logo = '/assets/logo/custom_admin.png'
config.logo = '/assets/logo/custom_store.jpg'
end
So use /assets/your_file_or_path and it will work :D

Related

Reails remote form format exists but not recognized

The following form intends to generate an XHR response
<% articlediscounts_for_article = #articlediscounts.where(article_id: article.id).first %>
<%= form_with(scope: articlediscounts_for_article, url: user_discount_users_path, local: false, method: :post) do |form| %>
the action processes
Processing by UsersController#user_discount as JS
and generates expected results, but fails in the rendering process, complaining about (with initial stack)
ActionController::UnknownFormat (UsersController#user_discount is missing a template for this request format and variant.
request.formats: ["text/javascript", "*/*"]
request.variant: []):
actionpack (6.1.3.2) lib/action_controller/metal/implicit_render.rb:42:in `default_render'
actionpack (6.1.3.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `block in send_action'
actionpack (6.1.3.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `tap'
actionpack (6.1.3.2) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
Yet that template clearly exists in the proper path (its corresponding partial is also present in the directory) as shown here:
This is perplexing as the warning message is contrary to the reality. The only assumptions that come to mind are that of some handling of form_with cmobined with the scope or the question of variant
What is mistaken here?

Upgraded Rails 4 to Rail 5- now getting "NoMethodError: undefined method `original_exception' for #<ActionView::Template::Error:0x007f243ecd5d48>"

As described, I updated my Rails from v4 to v5.1.5 by updating the version in the Gemfile and running rails app:update. I'm getting the following error that crashes my server whenever I try to load a page:
ActionView::Template::Error ($map2: (3rem 2.5rem 2rem 1.5rem 1.25rem 1rem 0.75rem) is not a map for `map-merge'):
19: src="https://maps.googleapis.com/maps/api/js?key=<%= ENV["GOOGLE_MAPS_KEY"]%>&callback=initMap"
20: type="text/javascript">
21: </script>
22: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
23: <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
24: <%= csrf_meta_tags %>
25: </head>
app/assets/stylesheets/application.scss:18
app/views/layouts/application.html.erb:22:in `_app_views_layouts_application_html_erb__2123457921920629012_70201480953880'
NoMethodError: undefined method `original_exception' for #<ActionView::Template::Error:0x007fb21c9d6068>
from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:16:in `block in render_exception_with_web_console'
from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:3:in `tap'
from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/extensions.rb:3:in `render_exception_with_web_console'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:69:in `rescue in call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/debug_exceptions.rb:58:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:20:in `block in call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `catch'
from /usr/local/rvm/gems/ruby-2.3.4/gems/web-console-2.3.0/lib/web_console/middleware.rb:18:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:36:in `call_app'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:24:in `block in call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:69:in `block in tagged'
from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:26:in `tagged'
from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/tagged_logging.rb:69:in `tagged'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/rack/logger.rb:24:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/request_id.rb:25:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/method_override.rb:22:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/runtime.rb:22:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/activesupport-5.1.5/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/executor.rb:12:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/actionpack-5.1.5/lib/action_dispatch/middleware/static.rb:125:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/sendfile.rb:111:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/railties-5.1.5/lib/rails/engine.rb:522:in `call'
from /usr/local/rvm/gems/ruby-2.3.4/gems/rack-2.0.4/lib/rack/handler/webrick.rb:86:in `service'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
from /usr/local/rvm/rubies/ruby-2.3.4/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
10.240.1.50 - - [06/Apr/2018:06:01:47 UTC] "GET / HTTP/1.1" 500 1477
- -> /
10.240.1.30 - - [06/Apr/2018:06:01:50 UTC] "GET /favicon.ico HTTP/1.1" 200 0
http://traid-emikaijuin.c9users.io/ -> /favicon.ico
I found a similar post which was to do with the default application.scss and application.js requiring directories which had not yet been created, but that does not apply in my case.
Here's the beginning of the application.html.erb:
<!DOCTYPE html>
<html>
<head>
<title>Workspace</title>
<link
href="https://fonts.googleapis.com/css?family=Raleway:200,400,700,800"
rel="stylesheet">
<script
src="https://code.jquery.com/jquery-3.3.1.js"
integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60="
crossorigin="anonymous"></script>
<script
defer
src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
<script
async
defer
src="https://maps.googleapis.com/maps/api/js?key=<%= ENV["GOOGLE_MAPS_KEY"]%>&callback=initMap"
type="text/javascript">
</script>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
and my application.scss
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_tree .
*= require_self
*/
#import "bulma";
#import "bootstrap";
// html {
// background-color: rgba(107,186,167,0.3);
// }
// body{
// }
Your web-console gem is out of date.
Try removing any version restrictions in Gemfile:
gem web-console
and then use
bundle update web-console
original_exception was changed to cause in Rails 5.1. See commit here: https://github.com/rails/rails/commit/b9ba263e5aaa151808df058f5babfed016a1879f
Replace original_exception with cause to fix the issue.

Hide ActionController::RoutingError in logs for assets

I am working on a rails app that has a WP home page, and also some images that are being load from WP. On localhost we don't have access to WP content that leads to having a lot of routing errors in logs, in example:
Started GET "/wp-content/uploads/2014/03/facebook-icon1.png" for 127.0.0.1 at 2015-11-20 15:10:48 +0200
ActionController::RoutingError (No route matches [GET] "/wp-content/uploads/2014/03/facebook-icon1.png"):
actionpack (4.2.5) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.2.5) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
Considering we have 5 images on the page we end up having 5 routing errors for each request.
How can I hide these type of errors from logs in dev environment?
Had this exact problem. Create a logger.rb file in your initializers folder and add this code:
# spammers were blowing up our logs
# this suppresses routing errors
if Rails.env.production?
class ActionDispatch::DebugExceptions
alias_method :old_log_error, :log_error
def log_error(env, wrapper)
if wrapper.exception.is_a? ActionController::RoutingError
return
else
old_log_error env, wrapper
end
end
end
end
Maybe this silencer gem can help you.
Usage:
In your environment:
require 'silencer/logger'
config.middleware.swap Rails::Rack::Logger, Silencer::Logger, :silence => [%r{^/wp-content/}]

rails broken on production mode and asset pipeline kills my app

rails broken on production mode and asset pipeline kills my app
This is the webpage, shows the error directly, I don' think the error in assets should break my app (annoyed Rails)
The assets files works really perfectly in static.
But really troublesome to migrate into Ruby on Rails
application.rb
config.assets.paths << "#{Rails.root}/vendor/themes"
config.assets.precompile << /(^[^_\/]|\/[^_])[^\/]*$/
production.rb
config.assets.precompile = ['*.js', '*.css', '*.css.erb']
config.assets.js_compressor = :uglifier
config.assets.compile = true
rake precompile
I, [2015-05-21T19:00:38.736247 #14721] INFO -- : Writing /Users/user_a/workspace/template/kyper_landing_page/public/assets/functions/_is-length-ed12829b6bbace0c320b87ad01ba0e91.css
I, [2015-05-21T19:00:38.742276 #14721] INFO -- : Writing /Users/user_a/workspace/template/kyper_landing_page/public/assets/functions/_is-light-ed12829b6bbace0c320b87ad01ba0e91.css
I, [2015-05-21T19:00:38.748894 #14721] INFO -- : Writing /Users/user_a/workspace/template/kyper_landing_page/public/assets/functions/_is-number-ed12829b6bbace0c320b87ad01ba0e91.css
I, [2015-05-21T19:00:38.754851 #14721] INFO -- : Writing /Users/user_a/workspace/template/kyper_landing_page/public/assets/functions/_is-size-ed12829b6bbace0c320b87ad01ba0e91.css
rake aborted!
Sass::SyntaxError: Undefined variable: "$em-base".
(in /Users/user_a/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/bourbon-4.2.3/app/assets/stylesheets/functions/_modular-scale.scss:21)
F, [2015-05-21T18:58:10.681816 #14585] FATAL -- :
ActionController::RoutingError (No route matches [HEAD] "/assets/img/backgrounds/3_darker#2x.jpg"):
actionpack (4.2.0) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (4.2.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.0) lib/rails/rack/logger.rb:38:in `call_app'
assets structure
There seems to be a problem with the syntax on file vendor/themes/css/style.css
Please check the syntax in the above mentioned file.
Check your style.css
on line no. 270, you have to write '}' after the selecter.
Thanks

Routing Error during "Ruby on Rails-Tutorial"

It seems like some people here had this problem but I couldn't find any solution in another topic.
I am doing Chapter 3 of the Ruby on Rails-Tutorial, working on the static pages. When I want to open them on the localhost it gives me a "Routing Error" in the Browser.
My Ruby is currently on version 1.9.3.
My Rails is currently on version 3.2.
I have tried:
restarting the server
saving all the files again
checking any issues in the static_pages_controller.rb
checking any issues in the routes.rb
checking any issues in the static_oages_spec.rb
Also there are no bugs in the HTML code of the single static page. And I can't find any more help in the tutorial, neither in other questions here on StackOverflow.
Edit:
This is the actual error message from the browser:
Routing Error
No route matches [GET] "/static_pages/home" Try running
rake routes for more information on available routes.
if I go to http://localhost:3000/static_pages/home, to one of three static pages I have.
This is routes.rb:
SampleApp::Application.routes.draw do
get "static_pages/home"
get "static_pages/help"
get "static_pages/about"
end
Also, I tried "rake routes" in the terminal, too. This is the result:
home_static_pages GET /static_pages/home(.:format) static_pages#home
help_static_pages GET /static_pages/help(.:format) static_pages#help
about_static_pages GET /static_pages/about(.:format) static_pages#about
static_pages POST /static_pages(.:format) static_pages#create
new_static_pages GET /static_pages/new(.:format) static_pages#new
edit_static_pages GET /static_pages/edit(.:format) static_pages#edit
GET /static_pages(.:format) static_pages#show
PUT /static_pages(.:format) static_pages#update
DELETE /static_pages(.:format) static_pages#destroy
And this is the error message the server is giving me:
Started GET "/static_pages/home.html" for 127.0.0.1 at 2012-04-03 13:23:54 +0200
ActionController::RoutingError (No route matches [GET] "/static_pages/home.html"):
actionpack (3.2.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.3) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.3) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.3) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.3) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.3) lib/rails/engine.rb:479:in `call'
railties (3.2.3) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.3) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/Network/Servers/pluto.kayoom.lan/Users/benediktkrebs/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Network/Servers/pluto.kayoom.lan/Users/benediktkrebs/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Network/Servers/pluto.kayoom.lan/Users/benediktkrebs/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Try this :
match "/static_pages/home" => "static_pages#home", :via => :get
match "/static_pages/help" => "static_pages#help", :via => :get
match "/static_pages/about" => "static_pages#about", :via => :get
Add into routes , restart the server and refresh browser .
If you are using Spork you must re-run Spork so your tests will consider the changes in config files like routes.rb, that are pre-loaded with Spork, so are not automatically updated.
Stop Spork (Ctrl + C)
Run Spork again (bundle exec spork)
Source: this is the source of this information
"after changing a file included in the prefork loading (such as routes.rb), you will have to restart the Spork server to load the new Rails environment.
If your tests are failing when you think they should be passing, quit the Spork server with Control-C and restart it
your routes.rb file has problems, use either RESTful style:
resource :static_pages do
collection do
get :home
get :help
get :about
end
end
or the non RESTful style:
match "static_pages/home", :controller => "static_pages", :action => "home"
match "static_pages/help", :controller => "static_pages", :action => "help"
match "static_pages/about", :controller => "static_pages", :action => "about"
for more details please refer to official guide: http://guides.rubyonrails.org/routing.html
I had a few problems working through the Rails Tutorial, and it helped to be able to consult the author's GitHub repo: https://github.com/railstutorial
Find the file you're working on and compare it line by line. Or just cut and paste the full file and see if it will run, then track down your error.
If you check the routes.rb in config you'll probably find that the there is a 'e' missing from /home. Add that and you are golden. Or green. Or whatever :)
check your http:// address, specifically if you are on localhost:3000/path or localhost:3000/path1/path2, etc
Once you change the format of your mapping from get to match you will not need static_pages anymore, just go straight to localhost:3000/pagename e.g localhost:3000/about
From Ruby 2 to Ruby 3 there are some differences, but still the documentation for 3 is not easy to be found. There should be a tutorial only for that: practical differences between rails 2 and 3.
The guide provided by downloading Ruby on rails is "The book of ruby" but it's not good anymore. It should at least contain an advice at the beginning of chapter 19.
In
config/routes.rb
uncomment
root :to => 'welcome#index'

Resources