ruby on rails - Where is the default "Welcome Aboard" page located in my app? -
i scoured app's directories, , can't find html page default rails welcome aboard page. cannot find route default welcome aboard page in routes.rb. how rails app route http://localhost:3000/
non-existent page in app?
the rails server produces information:
started "/" 127.0.0.1 @ 2013-07-31 02:00:13 -0600 processing rails::welcomecontroller#index html rendered /users/7stud/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/templates/rails/welcome/index.html.erb (0.1ms) completed 200 ok in 3ms (views: 2.5ms | activerecord: 0.0ms)
so looks me there controller buried in gem somewhere handles request.
since rails 4, "welcome aboard" page no longer located in public/index.html
. - you've detected - located inside 1 of rails gems.
so answered question yourself; "welcome aboard" page - in case - located @ /users/7stud/.rvm/gems/ruby-2.0.0-p247@railstutorial_rails_4_0/gems/railties-4.0.0/lib/rails/templates/rails/welcome/index.html.erb
to rid of it, following instructions on page. are:
- create controller
- add root route in
config/routes.rb
route newly created controller.
as how request application ends @ controller inside railties, let's dig gem: inside rails::application::finisher
find this:
initializer :add_builtin_route |app| if rails.env.development? app.routes.append '/rails/info/properties' => "rails/info#properties" '/rails/info/routes' => "rails/info#routes" '/rails/info' => "rails/info#index" '/' => "rails/welcome#index" end end end
this block adds few routes application when running in development mode - 1 of route "welcome aboard" action: get '/' => "rails/welcome#index"
this - other initializer - done when start application server (running rails server
or it). in case of finisher
, initializer run after other initializers run.
note how routes appended appear last in routeset. this, combined fact rails uses first matching route finds, ensures default routes used if no other route defined.
Comments
Post a Comment