06 Apr 2010
Static site using rails
原文地址：Static site using rails.
As we know rails is mainly used for dynamic website.we can also display static web pages or we can deploy full static website using rails. The following code can help us to display static pages.
Step 1:-Create Rails project
Step 2:-Generate StaticPage Controller
ruby script/generate controller static_pages page
Step 3:- Create StaticPage Class in Model
Step 4:- Add following line in routes.rb
map.page “page/:filename.:format”, :controller => ‘static_pages’, :action => ‘page’
Step 5:- Now add following line into static_pages controller
- Step 6:- All the static pages place in RAILS_ROOT/app/views/static_pages/ folder
Step 7 :- Start server and Type url as shown below.
蕲春人 at 09:12