forked from rails/rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rails is a dynamic framework that serves a static `index.html` by default. One of my first questions ever on IRC was solved by "delete your index.html". This file is a source of confusion when starting as it over-rides any set "root" in the routes yet it itself is not listed in the routes. By making the page dynamic by default we can eliminate this confusion and show people how to set the root on their project all at the same time. I encounter this question any time I am helping someone new learn Rails, and it is advice repeated again and again from our comments in rails/rails to external tutorials. We can remove this extra step and show people how to use rails root in the routes by allowing the index to be dynamic. This makes it easier to understand how to replace the root if desired, or to modify the index once generated since all rails helper methods are available. Eventually we can refactor this page to use standard Rails helpers instead of pure static html. Screenshot: ![](http://f.cl.ly/items/38212K0w1P063u2I0g2E/Screen%20Shot%202012-09-25%20at%204.51.42%20PM.png)
- Loading branch information
Showing
5 changed files
with
15 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
railties/lib/rails/generators/rails/app/templates/app/controllers/pages_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class PagesController < ApplicationController | ||
|
||
def index | ||
render layout: false | ||
end | ||
|
||
end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters