Skip to content

Instantly share code, notes, and snippets.

@tyok
Last active August 29, 2015 14:04
Show Gist options
  • Save tyok/237638e55d04512af3f6 to your computer and use it in GitHub Desktop.
Save tyok/237638e55d04512af3f6 to your computer and use it in GitHub Desktop.
Easy static pages on Rails
# Create an empty controller
class PagesController < ApplicationController
end
# 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