Static pages in Ruby on Rails

后端 未结 9 1086
终归单人心
终归单人心 2020-12-04 05:47

What are the standard way of making a Ruby on Rails application that will have pages such as

  • Home
  • About
  • Contact

I would appric

9条回答
  •  孤城傲影
    2020-12-04 06:15

    Jeff's Approach #1 works great for me. Here is a trick to make the controller dynamically look up pages. With this, you don't need to touch the controller nor the routes.rb for adding pages. Just drop the pages under app/views/pages and the controller will find it.

    class PagesController < ApplicationController
      def show
        render params[:id]
      end
    end
    

提交回复
热议问题