MacBook:shop xyz$ rails generate controller Home index ping pong create app/controllers/home_controller.rb route get "home/pong" route get "home/ping" route get "home/index" invoke erb create app/views/home create app/views/home/index.html.erb create app/views/home/ping.html.erb create app/views/home/pong.html.erb invoke test_unit create test/functional/home_controller_test.rb invoke helper create app/helpers/home_helper.rb invoke test_unit create test/unit/helpers/home_helper_test.rb invoke assets invoke coffee create app/assets/javascripts/home.js.coffee invoke scss create app/assets/stylesheets/home.css.scss MacBook:shop xyz$
MacBook:shop xyz$ rake routes
home_index GET /home/index(.:format) home#index
home_ping GET /home/ping(.:format) home#ping
home_pong GET /home/pong(.:format) home#pong
MacBook:shop xyz$
home_index GET /home/index(.:format)
home#index
home_ping GET /home/ping(.:format)
home#ping
home_pong GET /home/pong(.:format)
home#pong
home#index
, dass die
Route /home/index
in den Controller home
und dort zur Action/Methode index
geht. Definiert
werden diese Routen in der Datei config/routes.rb
.
rails generate controller Home index ping pong hat dort
automatisch folgende Zeilen eingefügt:get "home/index" get "home/ping" get "home/pong"