module SemiStatic::Controller::Page
Public Instance Methods
index()
click to toggle source
# File lib/semi_static/controller/page.rb, line 2 def index @articles = resource.all end
show()
click to toggle source
# File lib/semi_static/controller/page.rb, line 6 def show unless params[:id].valid_encoding? raise ActionController::RoutingError.new("Invalid Encoded URL") end @article = resource.find(params[:id]) unless @article raise ActionController::RoutingError.new(url_for(:id => params[:id], :only_path => true)) end unless params[:id] == @article.to_param redirect_to({id: @article}, status: :moved_permanently) end end
Private Instance Methods
resource()
click to toggle source
# File lib/semi_static/controller/page.rb, line 21 def resource request.env["semi_static.mapping"] end