Last active
August 29, 2015 14:04
-
-
Save tyok/237638e55d04512af3f6 to your computer and use it in GitHub Desktop.
Easy static pages on Rails
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
# Create an empty controller | |
class PagesController < ApplicationController | |
end |
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
# Add these to config/routes.rb | |
resources :pages do | |
collection do | |
get ':action', on: :collection, as: :static | |
end | |
end | |
# Then add the views. No need for actions. | |
# link helper: static_pages_path("about"), static_pages_path("home") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment