diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb index 941201b3356a766cc5721d60da3e30303ba931b6..fe16b97bd3fde1723c5633ce271578c0fa03b9ec 100644 --- a/actionpack/lib/action_controller/assertions.rb +++ b/actionpack/lib/action_controller/assertions.rb @@ -67,4 +67,4 @@ class TestCase #:nodoc: include ActionController::Assertions end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index a636f8b246206c391c7b89bea05d042eaa3de533..4d896bc2623662411d7b8732846d340760ef2740 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -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 hide_actions. 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 diff --git a/actionpack/lib/action_controller/components.rb b/actionpack/lib/action_controller/components.rb index dc3032219b57b803912df77a1d0818559651e2c5..5ef6e2afbad38531cff47840b005dc81e96c54e7 100644 --- a/actionpack/lib/action_controller/components.rb +++ b/actionpack/lib/action_controller/components.rb @@ -162,4 +162,4 @@ def process_cleanup_with_components end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb index 0f01873064eb324ad7e227b3349382ef3374bf23..66db80d8ef39919727bdf41c5560b75f3e1a59b9 100644 --- a/actionpack/lib/action_controller/cookies.rb +++ b/actionpack/lib/action_controller/cookies.rb @@ -72,4 +72,4 @@ def set_cookie(options) #:doc: @controller.response.headers["cookie"] << cookie end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/filters.rb b/actionpack/lib/action_controller/filters.rb index ec3f5096e35bc90ae813b4b1209e0e0007fbb623..03b65074f4444073f64da1f724fbcf6f37e465b3 100644 --- a/actionpack/lib/action_controller/filters.rb +++ b/actionpack/lib/action_controller/filters.rb @@ -754,4 +754,4 @@ def halt_filter_chain(filter, reason) end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/helpers.rb b/actionpack/lib/action_controller/helpers.rb index b42bc8a555a64da172d655e5af732020adb1b06f..251d32775f58341222ff0a5d928011c8199ef10f 100644 --- a/actionpack/lib/action_controller/helpers.rb +++ b/actionpack/lib/action_controller/helpers.rb @@ -200,4 +200,4 @@ def all_application_helpers end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/http_authentication.rb b/actionpack/lib/action_controller/http_authentication.rb index 78f41eb5030876f0da28caa67886da5d7725418f..4e77103de27edb9213f8fc0a0af860b5554e1e38 100644 --- a/actionpack/lib/action_controller/http_authentication.rb +++ b/actionpack/lib/action_controller/http_authentication.rb @@ -126,4 +126,4 @@ def authentication_request(controller, realm) end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 2806485a983d94d98a651c716f3983ed750abcc6..bfacfb26d1345530d4e7f4a468e5d9671c52ab42 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -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 diff --git a/actionpack/lib/action_controller/layout.rb b/actionpack/lib/action_controller/layout.rb index 5655a9bd0bcb60e22700d01aab28b6d6b24e5ecc..0c1513c9a1611716543db2bba9e79493299c33d8 100644 --- a/actionpack/lib/action_controller/layout.rb +++ b/actionpack/lib/action_controller/layout.rb @@ -306,4 +306,4 @@ def layout_directory?(layout_name) end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/mime_responds.rb b/actionpack/lib/action_controller/mime_responds.rb index 1f28f7ad13a45d26e69de89e81e00ae97ad12799..65eb7c896d0ffedb19677832744e8c422079dbf5 100644 --- a/actionpack/lib/action_controller/mime_responds.rb +++ b/actionpack/lib/action_controller/mime_responds.rb @@ -176,4 +176,4 @@ def respond end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/mime_type.rb b/actionpack/lib/action_controller/mime_type.rb index 44a60487b2c5b3c63fa4efe3309cd4b708612a11..7c7faefa46545b0de4d90779f34fbf77015e8653 100644 --- a/actionpack/lib/action_controller/mime_type.rb +++ b/actionpack/lib/action_controller/mime_type.rb @@ -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 diff --git a/actionpack/lib/action_controller/polymorphic_routes.rb b/actionpack/lib/action_controller/polymorphic_routes.rb index 0e826d4ee792921bbaaceb20372db00db58c3f75..2e048dfceb71b0ad5e0197d62cc34ce5551425d3 100644 --- a/actionpack/lib/action_controller/polymorphic_routes.rb +++ b/actionpack/lib/action_controller/polymorphic_routes.rb @@ -85,4 +85,4 @@ def extract_namespace(record_or_hash_or_array) end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/request.rb b/actionpack/lib/action_controller/request.rb index bab265f77e35f5019e5892c63e9ec9168960e59d..ceedcfec4f68190b4873550f4162a37421fc9f9e 100755 --- a/actionpack/lib/action_controller/request.rb +++ b/actionpack/lib/action_controller/request.rb @@ -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 diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb index 8eb6379fcfe7f0b6d4fb6921064ed32aad54d11e..8cffc90d3388606380fde1cc0630bb34594e60cc 100644 --- a/actionpack/lib/action_controller/rescue.rb +++ b/actionpack/lib/action_controller/rescue.rb @@ -157,4 +157,4 @@ def clean_backtrace(exception) end end end -end +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/resources.rb b/actionpack/lib/action_controller/resources.rb index 384f5f30d76df9e4d36f4b37504febf7a97e9177..e909a65eab8aa58313e03daad97cc4cfa1d25824 100644 --- a/actionpack/lib/action_controller/resources.rb +++ b/actionpack/lib/action_controller/resources.rb @@ -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 diff --git a/actionpack/lib/action_controller/routing.rb b/actionpack/lib/action_controller/routing.rb index d20c17c30ed4ec5dc8aa076924c4af0b9d4839a9..bbf6eefd8f69409dd5bd1c40c9da6f9efd8aebd6 100644 --- a/actionpack/lib/action_controller/routing.rb +++ b/actionpack/lib/action_controller/routing.rb @@ -1445,5 +1445,4 @@ def extract_request_environment(request) Routes = RouteSet.new end -end - +end \ No newline at end of file diff --git a/actionpack/lib/action_controller/session/active_record_store.rb b/actionpack/lib/action_controller/session/active_record_store.rb index c268cc1937c0102f2dd346233422a29c70facc85..14747c50522207c5caa896cf32b52ae5f3396db6 100644 --- a/actionpack/lib/action_controller/session/active_record_store.rb +++ b/actionpack/lib/action_controller/session/active_record_store.rb @@ -333,4 +333,4 @@ def logger end end end -end +end \ No newline at end of file