Skip to content

Make Default Index Page Dynamic #7771

Closed
wants to merge 1 commit into from
View
4 railties/CHANGELOG.md
@@ -1,5 +1,9 @@
## Rails 4.0.0 (unreleased) ##
+* Move `public/index.html` to a dynamic page `app/views/pages/index.html.erb`.
+
+ *Richard Schneeman*
+
* Engines with a dummy app include the rake tasks of dependencies in the app namespace.
Fix #8229
View
7 railties/lib/rails/generators/rails/app/templates/app/controllers/pages_controller.rb
@@ -0,0 +1,7 @@
+class PagesController < ApplicationController
+
+ def index
+ render layout: false
+ end
+
+end
View
0 ...ors/rails/app/templates/public/index.html → .../templates/app/views/pages/index.html.erb
File renamed without changes.
View
5 railties/lib/rails/generators/rails/app/templates/config/routes.rb
@@ -2,8 +2,9 @@
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
- # You can have the root of your site routed with "root" just remember to delete public/index.html.
- # root to: 'welcome#index'
+
+ # You can have the root of your site routed with "root"
+ root to: 'pages#index'
# Example of regular route:
# get 'products/:id' => 'catalog#view'
View
2 railties/test/generators/app_generator_test.rb
@@ -55,7 +55,7 @@ def test_assets
assert_file "app/views/layouts/application.html.erb", /javascript_include_tag\s+"application"/
assert_file "app/assets/stylesheets/application.css"
assert_file "config/application.rb", /config\.assets\.enabled = true/
- assert_file "public/index.html", /url\("assets\/rails.png"\);/
+ assert_file "app/views/pages/index.html.erb", /url\("assets\/rails.png"\);/
end
def test_invalid_application_name_raises_an_error
Something went wrong with that request. Please try again.