Skip to content

Instantly share code, notes, and snippets.

@nmerouze
Created April 22, 2009 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmerouze/99680 to your computer and use it in GitHub Desktop.
Save nmerouze/99680 to your computer and use it in GitHub Desktop.
### Rails Edge
$:.unshift File.join(File.dirname(__FILE__), 'rack-mount/lib')
$:.unshift File.join(File.dirname(__FILE__), 'rails/activesupport/lib')
$:.unshift File.join(File.dirname(__FILE__), 'rails/actionpack/lib')
require 'active_support'
require 'action_view'
require 'action_view/base'
require 'action_controller'
require 'action_controller/abstract'
require 'action_controller/new_base'
module ActionController
module Renderer
def render(action, options = {})
# TODO: Move this into #render_to_body
if action.is_a?(Hash)
options, action = action, nil
else
options.merge! :action => action
end
_process_options(options)
self.response_body = render_to_body(options).to_s
end
end
end
module ActionController
class MyBase < AbstractBase
use AbstractController::Callbacks
use AbstractController::Helpers
use AbstractController::Logger
use ActionController::HideActions
use ActionController::UrlFor
use ActionController::Renderer # just for clarity -- not required
use ActionController::Layouts
end
end
class MyAppController < ActionController::MyBase
def index
render :text => 'MyApp'
end
end
### Router
require 'rack/mount'
require 'rack/mount/mappers/rails_draft'
Routes = Rack::Mount::RouteSet.new
Routes.new_draw do |map|
controller :my_app do
match '/myapp', :to => 'index'
end
end
use Rack::ContentType, "text/plain"
run Routes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment