mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
dd98280e38
commit
de203245af
23 changed files with 272 additions and 266 deletions
|
@ -12,7 +12,6 @@ module AbstractController
|
||||||
end
|
end
|
||||||
|
|
||||||
class Base
|
class Base
|
||||||
|
|
||||||
attr_internal :response_body
|
attr_internal :response_body
|
||||||
attr_internal :response_obj
|
attr_internal :response_obj
|
||||||
attr_internal :action_name
|
attr_internal :action_name
|
||||||
|
@ -80,7 +79,6 @@ module AbstractController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def action_methods
|
def action_methods
|
||||||
self.class.action_methods
|
self.class.action_methods
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
module AbstractController
|
module AbstractController
|
||||||
class ActionNotFound < StandardError ; end
|
class ActionNotFound < StandardError; end
|
||||||
end
|
end
|
|
@ -68,6 +68,5 @@ module AbstractController
|
||||||
master_helper_module.module_eval(&block) if block_given?
|
master_helper_module.module_eval(&block) if block_given?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -59,8 +59,9 @@ module AbstractController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
# This will be overwritten
|
||||||
def _layout(details) end # This will be overwritten
|
def _layout(details)
|
||||||
|
end
|
||||||
|
|
||||||
# :api: plugin
|
# :api: plugin
|
||||||
# ====
|
# ====
|
||||||
|
|
|
@ -56,7 +56,9 @@ module AbstractController
|
||||||
_action_view._render_template_from_controller(options[:_template], options[:_layout], options, options[:_partial])
|
_action_view._render_template_from_controller(options[:_template], options[:_layout], options, options[:_partial])
|
||||||
end
|
end
|
||||||
|
|
||||||
def view_paths() _view_paths end
|
def view_paths()
|
||||||
|
_view_paths
|
||||||
|
end
|
||||||
|
|
||||||
# Return a string representation of a Rack-compatible response body.
|
# Return a string representation of a Rack-compatible response body.
|
||||||
def self.body_to_s(body)
|
def self.body_to_s(body)
|
||||||
|
@ -71,7 +73,6 @@ module AbstractController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def _determine_template(options)
|
def _determine_template(options)
|
||||||
name = (options[:_template_name] || action_name).to_s
|
name = (options[:_template_name] || action_name).to_s
|
||||||
|
|
||||||
|
@ -81,7 +82,6 @@ module AbstractController
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
|
|
||||||
def append_view_path(path)
|
def append_view_path(path)
|
||||||
self.view_paths << path
|
self.view_paths << path
|
||||||
end
|
end
|
||||||
|
|
|
@ -81,7 +81,9 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
module ClassMethods
|
module ClassMethods
|
||||||
def consider_all_requests_local() end
|
def consider_all_requests_local
|
||||||
|
end
|
||||||
|
|
||||||
def rescue_action(env)
|
def rescue_action(env)
|
||||||
raise env["action_dispatch.rescue.exception"]
|
raise env["action_dispatch.rescue.exception"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -129,6 +129,5 @@ module ActionController
|
||||||
def expires_now #:doc:
|
def expires_now #:doc:
|
||||||
response.headers["Cache-Control"] = "no-cache"
|
response.headers["Cache-Control"] = "no-cache"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -106,7 +106,6 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def default_helper_module!
|
def default_helper_module!
|
||||||
unless name.blank?
|
unless name.blank?
|
||||||
module_name = name.sub(/Controller$|$/, 'Helper')
|
module_name = name.sub(/Controller$|$/, 'Helper')
|
||||||
|
@ -125,6 +124,6 @@ module ActionController
|
||||||
extract = /^#{Regexp.quote(helpers_dir)}\/?(.*)_helper.rb$/
|
extract = /^#{Regexp.quote(helpers_dir)}\/?(.*)_helper.rb$/
|
||||||
Dir["#{helpers_dir}/**/*_helper.rb"].map { |file| file.sub extract, '\1' }
|
Dir["#{helpers_dir}/**/*_helper.rb"].map { |file| file.sub extract, '\1' }
|
||||||
end
|
end
|
||||||
end # ClassMethods
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,11 +7,15 @@ module ActionController
|
||||||
self.hidden_actions ||= Set.new
|
self.hidden_actions ||= Set.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def action_methods() self.class.action_names end
|
def action_methods
|
||||||
def action_names() action_methods end
|
self.class.action_names
|
||||||
|
end
|
||||||
|
|
||||||
|
def action_names
|
||||||
|
action_methods
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def action_method?(action_name)
|
def action_method?(action_name)
|
||||||
!hidden_actions.include?(action_name) && super
|
!hidden_actions.include?(action_name) && super
|
||||||
end
|
end
|
||||||
|
@ -27,7 +31,9 @@ module ActionController
|
||||||
@action_names ||= Set.new(super.reject {|name| self.hidden_actions.include?(name.to_s)})
|
@action_names ||= Set.new(super.reject {|name| self.hidden_actions.include?(name.to_s)})
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.action_names() action_methods end
|
def self.action_names
|
||||||
|
action_methods
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -14,7 +14,9 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
# :api: public
|
# :api: public
|
||||||
def controller_name() self.class.controller_name end
|
def controller_name
|
||||||
|
self.class.controller_name
|
||||||
|
end
|
||||||
|
|
||||||
# :api: public
|
# :api: public
|
||||||
def self.controller_path
|
def self.controller_path
|
||||||
|
@ -22,13 +24,19 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
# :api: public
|
# :api: public
|
||||||
def controller_path() self.class.controller_path end
|
def controller_path
|
||||||
|
self.class.controller_path
|
||||||
|
end
|
||||||
|
|
||||||
# :api: private
|
# :api: private
|
||||||
def self.action_names() action_methods end
|
def self.action_names
|
||||||
|
action_methods
|
||||||
|
end
|
||||||
|
|
||||||
# :api: private
|
# :api: private
|
||||||
def action_names() action_methods end
|
def action_names
|
||||||
|
action_methods
|
||||||
|
end
|
||||||
|
|
||||||
# :api: plugin
|
# :api: plugin
|
||||||
def self.call(env)
|
def self.call(env)
|
||||||
|
|
|
@ -12,7 +12,6 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def _determine_template(options)
|
def _determine_template(options)
|
||||||
super
|
super
|
||||||
if (!options.key?(:text) && !options.key?(:inline) && !options.key?(:partial)) || options.key?(:layout)
|
if (!options.key?(:text) && !options.key?(:inline) && !options.key?(:partial)) || options.key?(:layout)
|
||||||
|
@ -31,6 +30,5 @@ module ActionController
|
||||||
"String, true, or false, expected for `layout'; you passed #{name.inspect}"
|
"String, true, or false, expected for `layout'; you passed #{name.inspect}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,6 +29,5 @@ module ActionController
|
||||||
response.body = body if response
|
response.body = body if response
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -30,7 +30,6 @@ module ActionController
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def _prefix
|
def _prefix
|
||||||
controller_path
|
controller_path
|
||||||
end
|
end
|
||||||
|
|
|
@ -33,7 +33,6 @@ module ActionController #:nodoc:
|
||||||
attr_internal :rescued_exception
|
attr_internal :rescued_exception
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def method_for_action(action_name)
|
def method_for_action(action_name)
|
||||||
return action_name if self.rescued_exception = request.env.delete("action_dispatch.rescue.exception")
|
return action_name if self.rescued_exception = request.env.delete("action_dispatch.rescue.exception")
|
||||||
super
|
super
|
||||||
|
|
|
@ -35,6 +35,5 @@ module ActionController
|
||||||
_process_action_callbacks.find_all{|x| x.kind == :before}.map{|x| x.name}
|
_process_action_callbacks.find_all{|x| x.kind == :before}.map{|x| x.name}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue