SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
-
Nov 28, 2007, 09:00 #1
- Join Date
- Oct 2007
- Posts
- 49
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Adding static pages to a Rails project
Hi Folks,
I'm trying to figure out the best way to add pages that will not change to a Rails project. For instance, about us, contact us, etc etc.
So basically, what I want the URL to look like would be: http://www.abcdefg123.com/about
Sorry for the total noob question!
-
Nov 28, 2007, 10:26 #2
- Join Date
- Feb 2006
- Location
- Worcs. UK
- Posts
- 404
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You can put static content in the public folder. So the file public/about.html will appear as http://www.abcdefg123.com/about.html.
You could also consider replacing index.html with your own custom home page. The content of this file will appear when you enter http://www.abcdefg123.com
The advantage of a static home page is that it will be very fast to load. The disadvantage is that ... well ... it's static. That means modifying it requires alteration of the code. So personally, I'd limit use of static pages to a minimum. Even contact pages change!
-
Nov 28, 2007, 10:34 #3
- Join Date
- Oct 2007
- Posts
- 49
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thank you! Sometimes I miss the forest for the trees, and this is definitely one of those cases. lol
Just tried it out and it works perfectly under the public folder...and I will definitely keep in mind the potential for things to change and when to use/not use it.
By the way, is using public/index.html as a default homepage common practice to save on load times/database access?
-
Nov 28, 2007, 10:51 #4
I usually don't use /public/index.html in that way, primarily because I usually want to use the database on the front page. I sometimes stick these static pages in their own controller (like a "main" controller, for example) just so I can keep organized and to use layouts, partials, and other aspects that the rest of my app uses.
.
Zach Holman
good-tutorials — blog — twitter — last.fm
-
Nov 28, 2007, 10:57 #5
- Join Date
- Oct 2007
- Posts
- 49
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Nov 28, 2007, 13:29 #6
- Join Date
- Aug 2005
- Posts
- 986
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Use Rails' caching capabilities! That way you get the good stuff and the speed
Bookmarks