aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 23:12:57 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-09-09 23:12:57 +0000
commitff9ca2ca1e1646e22ff43ec1a5844a0b733d5ba3 (patch)
tree49b43406a1b173aafc25959f679189c742fd24e3
parent2c690edb940b55366bc479fc7e51fc620fd85d5b (diff)
downloadrails-ff9ca2ca1e1646e22ff43ec1a5844a0b733d5ba3.tar.gz
rails-ff9ca2ca1e1646e22ff43ec1a5844a0b733d5ba3.tar.bz2
rails-ff9ca2ca1e1646e22ff43ec1a5844a0b733d5ba3.zip
Random hits from the style nazi
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7438 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/lib/action_controller/assertions.rb2
-rwxr-xr-xactionpack/lib/action_controller/base.rb40
-rw-r--r--actionpack/lib/action_controller/components.rb2
-rw-r--r--actionpack/lib/action_controller/cookies.rb2
-rw-r--r--actionpack/lib/action_controller/filters.rb2
-rw-r--r--actionpack/lib/action_controller/helpers.rb2
-rw-r--r--actionpack/lib/action_controller/http_authentication.rb2
-rw-r--r--actionpack/lib/action_controller/integration.rb15
-rw-r--r--actionpack/lib/action_controller/layout.rb2
-rw-r--r--actionpack/lib/action_controller/mime_responds.rb2
-rw-r--r--actionpack/lib/action_controller/mime_type.rb2
-rw-r--r--actionpack/lib/action_controller/polymorphic_routes.rb2
-rwxr-xr-xactionpack/lib/action_controller/request.rb2
-rw-r--r--actionpack/lib/action_controller/rescue.rb2
-rw-r--r--actionpack/lib/action_controller/resources.rb2
-rw-r--r--actionpack/lib/action_controller/routing.rb3
-rw-r--r--actionpack/lib/action_controller/session/active_record_store.rb2
17 files changed, 54 insertions, 32 deletions
diff --git a/actionpack/lib/action_controller/assertions.rb b/actionpack/lib/action_controller/assertions.rb
index 941201b335..fe16b97bd3 100644
--- a/actionpack/lib/action_controller/assertions.rb
+++ b/actionpack/lib/action_controller/assertions.rb
@@ -67,4 +67,4 @@ module Test #: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 a636f8b246..4d896bc262 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -11,12 +11,16 @@ require 'set'
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 @@ module ActionController #:nodoc:
@failures = failures
end
end
+
class MethodNotAllowed < ActionControllerError #:nodoc:
attr_reader :allowed_methods
@@ -40,16 +45,22 @@ module ActionController #:nodoc:
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 @@ module ActionController #:nodoc:
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 @@ module ActionController #:nodoc:
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 @@ module ActionController #:nodoc:
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 @@ module ActionController #:nodoc:
# 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 @@ module ActionController #:nodoc:
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 @@ module ActionController #:nodoc:
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 @@ module ActionController #: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 @@ module ActionController #:nodoc:
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 dc3032219b..5ef6e2afba 100644
--- a/actionpack/lib/action_controller/components.rb
+++ b/actionpack/lib/action_controller/components.rb
@@ -162,4 +162,4 @@ module ActionController #:nodoc:
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 0f01873064..66db80d8ef 100644
--- a/actionpack/lib/action_controller/cookies.rb
+++ b/actionpack/lib/action_controller/cookies.rb
@@ -72,4 +72,4 @@ module ActionController #:nodoc:
@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 ec3f5096e3..03b65074f4 100644
--- a/actionpack/lib/action_controller/filters.rb
+++ b/actionpack/lib/action_controller/filters.rb
@@ -754,4 +754,4 @@ module ActionController #:nodoc:
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 b42bc8a555..251d32775f 100644
--- a/actionpack/lib/action_controller/helpers.rb
+++ b/actionpack/lib/action_controller/helpers.rb
@@ -200,4 +200,4 @@ module ActionController #:nodoc:
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 78f41eb503..4e77103de2 100644
--- a/actionpack/lib/action_controller/http_authentication.rb
+++ b/actionpack/lib/action_controller/http_authentication.rb
@@ -126,4 +126,4 @@ module ActionController
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 2806485a98..bfacfb26d1 100644
--- a/actionpack/lib/action_controller/integration.rb
+++ b/actionpack/lib/action_controller/integration.rb
@@ -152,27 +152,27 @@ module ActionController
#
# 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 @@ module ActionController
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 @@ module ActionController
"#{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 @@ module ActionController
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 5655a9bd0b..0c1513c9a1 100644
--- a/actionpack/lib/action_controller/layout.rb
+++ b/actionpack/lib/action_controller/layout.rb
@@ -306,4 +306,4 @@ module ActionController #:nodoc:
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 1f28f7ad13..65eb7c896d 100644
--- a/actionpack/lib/action_controller/mime_responds.rb
+++ b/actionpack/lib/action_controller/mime_responds.rb
@@ -176,4 +176,4 @@ module ActionController #:nodoc:
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 44a60487b2..7c7faefa46 100644
--- a/actionpack/lib/action_controller/mime_type.rb
+++ b/actionpack/lib/action_controller/mime_type.rb
@@ -154,4 +154,4 @@ module Mime
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 0e826d4ee7..2e048dfceb 100644
--- a/actionpack/lib/action_controller/polymorphic_routes.rb
+++ b/actionpack/lib/action_controller/polymorphic_routes.rb
@@ -85,4 +85,4 @@ module ActionController
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 bab265f77e..ceedcfec4f 100755
--- a/actionpack/lib/action_controller/request.rb
+++ b/actionpack/lib/action_controller/request.rb
@@ -660,4 +660,4 @@ module ActionController
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 8eb6379fcf..8cffc90d33 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -157,4 +157,4 @@ module ActionController #:nodoc:
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 384f5f30d7..e909a65eab 100644
--- a/actionpack/lib/action_controller/resources.rb
+++ b/actionpack/lib/action_controller/resources.rb
@@ -514,4 +514,4 @@ module ActionController
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 d20c17c30e..bbf6eefd8f 100644
--- a/actionpack/lib/action_controller/routing.rb
+++ b/actionpack/lib/action_controller/routing.rb
@@ -1445,5 +1445,4 @@ module ActionController
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 c268cc1937..14747c5052 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 @@ class CGI
end
end
end
-end
+end \ No newline at end of file