1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_controller/metal/compatibility.rb

81 lines
2.3 KiB
Ruby
Raw Normal View History

2009-04-27 21:21:26 -04:00
module ActionController
module Compatibility
extend ActiveSupport::Concern
class ::ActionController::ActionControllerError < StandardError #:nodoc:
end
module ClassMethods
end
# Temporary hax
included do
::ActionController::UnknownAction = ::AbstractController::ActionNotFound
::ActionController::DoubleRenderError = ::AbstractController::DoubleRenderError
# ROUTES TODO: This should be handled by a middleware and route generation
# should be able to handle SCRIPT_NAME
self.config.relative_url_root = ENV['RAILS_RELATIVE_URL_ROOT']
2009-08-10 11:40:41 -04:00
class << self
delegate :default_charset=, :to => "ActionDispatch::Response"
end
# cattr_reader :protected_instance_variables
cattr_accessor :protected_instance_variables
2009-10-29 00:37:29 -04:00
self.protected_instance_variables = %w(@assigns @performed_redirect @performed_render
@variables_added @request_origin @url
@parent_controller @action_name
@before_filter_chain_aborted @_headers @_params
2010-01-15 15:44:27 -05:00
@_response)
def rescue_action(env)
raise env["action_dispatch.rescue.exception"]
end
2009-05-15 20:49:11 -04:00
self.page_cache_directory = defined?(Rails.public_path) ? Rails.public_path : ""
end
# For old tests
def initialize_template_class(*) end
def assign_shortcuts(*) end
2009-05-20 18:33:08 -04:00
def template
@template ||= view_context
end
def process_action(*)
template
super
2009-05-20 18:33:08 -04:00
end
def _normalize_options(options)
# TODO Deprecate this. Rails 2.x allowed to give a template as action.
if options[:action] && options[:action].to_s.include?(?/)
options[:template] = options.delete(:action)
2009-04-27 21:21:26 -04:00
end
options[:text] = nil if options.delete(:nothing) == true
options[:text] = " " if options.key?(:text) && options[:text].nil?
super
end
2009-05-11 15:04:43 -04:00
def render_to_body(options)
options[:template].sub!(/^\//, '') if options.key?(:template)
super || " "
2009-04-27 21:21:26 -04:00
end
def _handle_method_missing
method_missing(@_action_name.to_sym)
end
def method_for_action(action_name)
super || (respond_to?(:method_missing) && "_handle_method_missing")
end
def performed?
response_body
end
2009-04-27 21:21:26 -04:00
end
end