add simple blog controller

This commit is contained in:
Torsten Ruger
2018-04-10 19:11:33 +03:00
parent 5950fac3ce
commit 4b927c4f29
5 changed files with 248 additions and 0 deletions

View File

@ -0,0 +1,19 @@
class BlogController < ApplicationController
def index
@pages = Page.pages
end
def page
title = params[:title]
return redirect_to(root_path) unless title
@page = get_page(title)
return redirect_to(root_path) unless @page
end
def get_page(title)
page = Page.pages[title]
#puts "No #{title} in #{Page.pages.keys.join(':')}"
page
end
end