This file contains hidden or 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
/* | |
apxs -c mod_helloworld.c | |
LoadModule helloworld_module modules/mod_helloworld.so | |
<Location /helloworld> | |
SetHandler helloworld | |
</Location> | |
*/ |
This file contains hidden or 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
# Allow the metal piece to run in isolation | |
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails) | |
class Scaling | |
def self.call(env) | |
if env["PATH_INFO"] =~ /^\/scaling/ | |
[200, {"Content-Type" => "text/html"}, ["Hello, World!"]] | |
else | |
[404, {"Content-Type" => "text/html"}, ["Not Found"]] | |
end |
This file contains hidden or 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
diff --git a/actionpack/lib/action_controller/test_process.rb b/actionpack/lib/action_controller/test_process.rb | |
index dddad17..acfb10c 100644 | |
--- a/actionpack/lib/action_controller/test_process.rb | |
+++ b/actionpack/lib/action_controller/test_process.rb | |
@@ -388,20 +388,33 @@ module ActionController #:nodoc: | |
module TestProcess | |
def self.included(base) | |
- # execute the request simulating a specific HTTP method and set/volley the response | |
- # TODO: this should be un-DRY'ed for the sake of API documentation. |
This file contains hidden or 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
commit 96e2c827ea2d6f147fbcfc1d986f39f146df3b6e | |
Author: Pratik Naik <[email protected]> | |
Date: Sun Dec 28 16:03:49 2008 +0000 | |
Revert "Revert inline docs" | |
This reverts commit aaea12c497ca86a86fbda8409c226630ade22f89. | |
diff --git a/actionpack/lib/action_controller/routing/route_set.rb b/actionpack/lib/action_controller/routing/route_set.rb | |
index 13646ae..d4c53ff 100644 |
This file contains hidden or 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
Query String : x[y][z][]=10&x[y][z][]=5 | |
Rails : [["x[y][z][]", "10"], ["x[y][z][]", "5"]] | |
Rack::Utils : [["x[y][z][]", ["10", "5"]]] |
This file contains hidden or 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
module Rack | |
class Evil | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
catch(:response) { @app.call(env) } | |
end | |
end |
This file contains hidden or 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
module Rack | |
class Callbacks < ::Array | |
DUMMY_APP = proc {|env| } | |
def initialize(app, &block) | |
@app = app | |
instance_eval(&block) if block_given? | |
end | |
def use(middleware, *args, &block) |
This file contains hidden or 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
module Rack | |
class Callbacks | |
def initialize(&block) | |
@before = [] | |
@after = [] | |
instance_eval(&block) if block_given? | |
end | |
def before(middleware, *args, &block) | |
if block_given? |
This file contains hidden or 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
class RailsHelpers | |
def form_for(object) | |
is_record_new = api_hook_record_new(object) | |
end | |
private | |
def api_hook_record_new(object) | |
# option 1 : raise "Should be overridden by ORM" | |
# option 2 : object.new_record? |
This file contains hidden or 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
class User < ActiveRecord::Base | |
# establish_connection :main_database | |
end | |
class Book < ActiveRecord::Base | |
establish_connection :second_database | |
end | |
ActiveRecord::Base.with_connection do | |
Book.do_some_shit! |