Last active
August 29, 2015 14:00
-
-
Save ROFISH/11273048 to your computer and use it in GitHub Desktop.
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
require 'rubygems' | |
require 'bundler/setup' | |
require 'yaml' | |
require 'action_dispatch' | |
require 'action_controller' | |
require 'action_view' | |
routes = ActionDispatch::Routing::RouteSet.new | |
routes.draw do | |
get '/' => 'mainpage#index' | |
get '/page/:id' => 'mainpage#show' | |
end | |
class MainpageController < ActionController::Metal | |
include AbstractController::Rendering | |
include ActionView::Rendering | |
prepend_view_path('/path/to/templates') | |
include ActionController::Rendering | |
include ActionController::ImplicitRender | |
def index | |
self.response_body = "<h1>Front Page</h1>" | |
end | |
def show | |
self.status = 404 | |
self.response_body = "<pre>#{env['action_dispatch.request.path_parameters'][:id]}</pre>" | |
end | |
end | |
#use ActionDispatch::ShowExceptions, ActionDispatch::PublicExceptions.new("public/") | |
use ActionDispatch::DebugExceptions | |
run routes |
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
#ruby '2.1.0' | |
source 'https://rubygems.org' | |
gem 'rack', '~>1.5.2' | |
gem 'actionpack', '~> 4.1.0.beta1' | |
gem 'railties', '~> 4.1.0.beta1' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment