How to do static content in Rails?

后端 未结 8 927
孤城傲影
孤城傲影 2020-11-30 17:47

Looking at different options:

One is to just put the static pages in the public/ folder, but I do want the header from layout/application to be consistent.

I

8条回答
  •  醉梦人生
    2020-11-30 18:31

    Create a PagesController for your static pages (e.g contact) and insert

    def contact_page
    end
    

    in config/routes.rb insert

    get 'contact' => 'pages#contact_page'
    

    which will display the content from views/pages/contact_page.html.erb

提交回复
热议问题