Random hits from the style nazi

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7438 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 2c690edb
......@@ -67,4 +67,4 @@ class TestCase #:nodoc:
include ActionController::Assertions
end
end
end
end
\ No newline at end of file
......@@ -11,12 +11,16 @@
module ActionController #:nodoc:
class ActionControllerError < StandardError #:nodoc:
end
class SessionRestoreError < ActionControllerError #:nodoc:
end
class MissingTemplate < ActionControllerError #:nodoc:
end
class RenderError < ActionControllerError #:nodoc:
end
class RoutingError < ActionControllerError #:nodoc:
attr_reader :failures
def initialize(message, failures=[])
......@@ -24,6 +28,7 @@ def initialize(message, failures=[])
@failures = failures
end
end
class MethodNotAllowed < ActionControllerError #:nodoc:
attr_reader :allowed_methods
......@@ -40,16 +45,22 @@ def handle_response!(response)
response.headers['Allow'] ||= allowed_methods_header
end
end
class NotImplemented < MethodNotAllowed #:nodoc:
end
class UnknownController < ActionControllerError #:nodoc:
end
class UnknownAction < ActionControllerError #:nodoc:
end
class MissingFile < ActionControllerError #:nodoc:
end
class RenderError < ActionControllerError #:nodoc:
end
class SessionOverflowError < ActionControllerError #:nodoc:
DEFAULT_MESSAGE = 'Your session data is larger than the data column in which it is to be stored. You must increase the size of your data column if you intend to store large data.'
......@@ -57,6 +68,7 @@ def initialize(message = nil)
super(message || DEFAULT_MESSAGE)
end
end
class DoubleRenderError < ActionControllerError #:nodoc:
DEFAULT_MESSAGE = "Render and/or redirect were called multiple times in this action. Please note that you may only call render OR redirect, and only once per action. Also note that neither redirect nor render terminate execution of the action, so if you want to exit an action after redirecting, you need to do something like \"redirect_to(...) and return\". Finally, note that to cause a before filter to halt execution of the rest of the filter chain, the filter must return false, explicitly, so \"render(...) and return false\"."
......@@ -64,6 +76,7 @@ def initialize(message = nil)
super(message || DEFAULT_MESSAGE)
end
end
class RedirectBackError < ActionControllerError #:nodoc:
DEFAULT_MESSAGE = 'No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].'
......@@ -72,6 +85,7 @@ def initialize(message = nil)
end
end
# Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed
# on request and then either render a template or redirect to another action. An action is defined as a public method
# on the controller, which will automatically be made accessible to the web-server through Rails Routes.
......@@ -371,7 +385,10 @@ def controller_path
# By default, all methods defined in ActionController::Base and included modules are hidden.
# More methods can be hidden using <tt>hide_actions</tt>.
def hidden_actions
write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods) unless read_inheritable_attribute(:hidden_actions)
unless read_inheritable_attribute(:hidden_actions)
write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods)
end
read_inheritable_attribute(:hidden_actions)
end
......@@ -817,12 +834,17 @@ def render(options = nil, &block) #:doc:
elsif partial = options[:partial]
partial = default_template_name if partial == true
add_variables_to_assigns
if collection = options[:collection]
render_for_text(@template.send(:render_partial_collection, partial, collection, options[:spacer_template], options[:locals]),
options[:status])
render_for_text(
@template.send(:render_partial_collection, partial, collection,
options[:spacer_template], options[:locals]), options[:status]
)
else
render_for_text(@template.send(:render_partial, partial, ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals]),
options[:status])
render_for_text(
@template.send(:render_partial, partial,
ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals]), options[:status]
)
end
elsif options[:update]
......@@ -1012,8 +1034,8 @@ def reset_session #:doc:
response.session = @_session
end
private
private
def render_for_file(template_path, status = nil, use_full_path = false, locals = {}) #:nodoc:
add_variables_to_assigns
assert_existence_of_template_file(template_path) if use_full_path
......@@ -1035,7 +1057,9 @@ def render_for_text(text = nil, status = nil, append_response = false) #:nodoc:
end
def initialize_template_class(response)
raise "You must assign a template class through ActionController.template_class= before processing a request" unless @@template_class
unless @@template_class
raise "You must assign a template class through ActionController.template_class= before processing a request"
end
response.template = ActionView::Base.new(view_paths, {}, self)
response.template.extend self.class.master_helper_module
......@@ -1207,4 +1231,4 @@ def process_cleanup
close_session
end
end
end
end
\ No newline at end of file
......@@ -162,4 +162,4 @@ def process_cleanup_with_components
end
end
end
end
end
\ No newline at end of file
......@@ -72,4 +72,4 @@ def set_cookie(options) #:doc:
@controller.response.headers["cookie"] << cookie
end
end
end
end
\ No newline at end of file
......@@ -754,4 +754,4 @@ def halt_filter_chain(filter, reason)
end
end
end
end
end
\ No newline at end of file
......@@ -200,4 +200,4 @@ def all_application_helpers
end
end
end
end
end
\ No newline at end of file
......@@ -126,4 +126,4 @@ def authentication_request(controller, realm)
end
end
end
end
end
\ No newline at end of file
......@@ -152,27 +152,27 @@ def redirect?
#
# You can also perform POST, PUT, DELETE, and HEAD requests with #post,
# #put, #delete, and #head.
def get(path, parameters=nil, headers=nil)
def get(path, parameters = nil, headers = nil)
process :get, path, parameters, headers
end
# Performs a POST request with the given parameters. See get() for more details.
def post(path, parameters=nil, headers=nil)
def post(path, parameters = nil, headers = nil)
process :post, path, parameters, headers
end
# Performs a PUT request with the given parameters. See get() for more details.
def put(path, parameters=nil, headers=nil)
def put(path, parameters = nil, headers = nil)
process :put, path, parameters, headers
end
# Performs a DELETE request with the given parameters. See get() for more details.
def delete(path, parameters=nil, headers=nil)
def delete(path, parameters = nil, headers = nil)
process :delete, path, parameters, headers
end
# Performs a HEAD request with the given parameters. See get() for more details.
def head(path, parameters=nil, headers=nil)
def head(path, parameters = nil, headers = nil)
process :head, path, parameters, headers
end
......@@ -220,7 +220,7 @@ def interpret_uri(path)
end
# Performs the actual request.
def process(method, path, parameters=nil, headers=nil)
def process(method, path, parameters = nil, headers = nil)
data = requestify(parameters)
path = interpret_uri(path) if path =~ %r{://}
path = "/#{path}" unless path[0] == ?/
......@@ -333,7 +333,6 @@ def requestify(parameters, prefix=nil)
"#{CGI.escape(prefix)}=#{CGI.escape(parameters.to_s)}"
end
end
end
# A module used to extend ActionController::Base, so that integration tests
......@@ -553,4 +552,4 @@ def method_missing(sym, *args, &block)
end
end
end
end
end
\ No newline at end of file
......@@ -306,4 +306,4 @@ def layout_directory?(layout_name)
end
end
end
end
end
\ No newline at end of file
......@@ -176,4 +176,4 @@ def respond
end
end
end
end
end
\ No newline at end of file
......@@ -154,4 +154,4 @@ def method_missing(method, *args)
end
end
require 'action_controller/mime_types'
require 'action_controller/mime_types'
\ No newline at end of file
......@@ -85,4 +85,4 @@ def extract_namespace(record_or_hash_or_array)
end
end
end
end
end
\ No newline at end of file
......@@ -660,4 +660,4 @@ def type_conflict!(klass, value)
raise TypeError, "Conflicting types for parameter containers. Expected an instance of #{klass} but found an instance of #{value.class}. This can be caused by colliding Array and Hash parameters like qs[]=value&qs[key]=value."
end
end
end
end
\ No newline at end of file
......@@ -157,4 +157,4 @@ def clean_backtrace(exception)
end
end
end
end
end
\ No newline at end of file
......@@ -514,4 +514,4 @@ def action_options_for(action, resource, method = nil)
end
end
ActionController::Routing::RouteSet::Mapper.send :include, ActionController::Resources
ActionController::Routing::RouteSet::Mapper.send :include, ActionController::Resources
\ No newline at end of file
......@@ -1445,5 +1445,4 @@ def extract_request_environment(request)
Routes = RouteSet.new
end
end
end
\ No newline at end of file
......@@ -333,4 +333,4 @@ def logger
end
end
end
end
end
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册