Included modules
Classes and Modules
Public Class methods
call
(env)
[show source]
# File lib/scaffolding_extensions/controller/rack.rb, line 29 def self.call(env) new.call(env) end
scaffold_setup_helper
()
[show source]
# File lib/scaffolding_extensions/controller/rack.rb, line 26 def self.scaffold_setup_helper end
Public Instance methods
call
(env)
[show source]
# File lib/scaffolding_extensions/controller/rack.rb, line 37 def call(env) s = 200 h = {'Content-Type'=>'text/html'} b = '' @params = Hash.new{|hash, k| hash[k.to_s] if k.is_a?(Symbol)} params.merge!(parse_nested_query(env["QUERY_STRING"])) params.merge!(parse_nested_query(env["rack.input"].read)) if env["REQUEST_METHOD"] == 'POST' @scaffold_method = meth = if ['', '/'].include?(env["PATH_INFO"]) 'index' elsif captures = %r{\A/(\w+)(?:/(\w+))?\z}.match(env["PATH_INFO"]) params['id'] ||= captures[2] captures[1] end if !['GET', 'POST'].include?(env["REQUEST_METHOD"]) || (env["REQUEST_METHOD"] == "GET" && scaffolded_nonidempotent_method?(meth)) return [403, h, 'Method Not Allowed'] end if scaffolded_method?(meth) @scaffold_path = env['SCRIPT_NAME'] @request = env @response = h begin b = send(meth) rescue Redirect => e s = 302 h['Location'] = e.message end else s = 404 b = 'Not Found' end [s, h, [b]] end