Changeset 7438
- Timestamp:
- 09/09/07 23:12:57 (1 year ago)
- Files:
-
- trunk/actionpack/lib/action_controller/base.rb (modified) (10 diffs)
- trunk/actionpack/lib/action_controller/integration.rb (modified) (3 diffs)
- trunk/actionpack/lib/action_controller/routing.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/base.rb
r7426 r7438 12 12 class ActionControllerError < StandardError #:nodoc: 13 13 end 14 14 15 class SessionRestoreError < ActionControllerError #:nodoc: 15 16 end 17 16 18 class MissingTemplate < ActionControllerError #:nodoc: 17 19 end 20 18 21 class RenderError < ActionControllerError #:nodoc: 19 22 end 23 20 24 class RoutingError < ActionControllerError #:nodoc: 21 25 attr_reader :failures … … 25 29 end 26 30 end 31 27 32 class MethodNotAllowed < ActionControllerError #:nodoc: 28 33 attr_reader :allowed_methods … … 41 46 end 42 47 end 48 43 49 class NotImplemented < MethodNotAllowed #:nodoc: 44 50 end 51 45 52 class UnknownController < ActionControllerError #:nodoc: 46 53 end 54 47 55 class UnknownAction < ActionControllerError #:nodoc: 48 56 end 57 49 58 class MissingFile < ActionControllerError #:nodoc: 50 59 end 60 51 61 class RenderError < ActionControllerError #:nodoc: 52 62 end 63 53 64 class SessionOverflowError < ActionControllerError #:nodoc: 54 65 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.' … … 58 69 end 59 70 end 71 60 72 class DoubleRenderError < ActionControllerError #:nodoc: 61 73 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\"." … … 65 77 end 66 78 end 79 67 80 class RedirectBackError < ActionControllerError #:nodoc: 68 81 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 85 end 73 86 end 87 74 88 75 89 # Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed … … 372 386 # More methods can be hidden using <tt>hide_actions</tt>. 373 387 def hidden_actions 374 write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods) unless read_inheritable_attribute(:hidden_actions) 388 unless read_inheritable_attribute(:hidden_actions) 389 write_inheritable_attribute(:hidden_actions, ActionController::Base.public_instance_methods) 390 end 391 375 392 read_inheritable_attribute(:hidden_actions) 376 393 end … … 818 835 partial = default_template_name if partial == true 819 836 add_variables_to_assigns 837 820 838 if collection = options[:collection] 821 render_for_text(@template.send(:render_partial_collection, partial, collection, options[:spacer_template], options[:locals]), 822 options[:status]) 839 render_for_text( 840 @template.send(:render_partial_collection, partial, collection, 841 options[:spacer_template], options[:locals]), options[:status] 842 ) 823 843 else 824 render_for_text(@template.send(:render_partial, partial, ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals]), 825 options[:status]) 844 render_for_text( 845 @template.send(:render_partial, partial, 846 ActionView::Base::ObjectWrapper.new(options[:object]), options[:locals]), options[:status] 847 ) 826 848 end 827 849 … … 1013 1035 end 1014 1036 1037 1015 1038 private 1016 1017 1039 def render_for_file(template_path, status = nil, use_full_path = false, locals = {}) #:nodoc: 1018 1040 add_variables_to_assigns … … 1036 1058 1037 1059 def initialize_template_class(response) 1038 raise "You must assign a template class through ActionController.template_class= before processing a request" unless @@template_class 1060 unless @@template_class 1061 raise "You must assign a template class through ActionController.template_class= before processing a request" 1062 end 1039 1063 1040 1064 response.template = ActionView::Base.new(view_paths, {}, self) trunk/actionpack/lib/action_controller/integration.rb
r7436 r7438 153 153 # You can also perform POST, PUT, DELETE, and HEAD requests with #post, 154 154 # #put, #delete, and #head. 155 def get(path, parameters =nil, headers=nil)155 def get(path, parameters = nil, headers = nil) 156 156 process :get, path, parameters, headers 157 157 end 158 158 159 159 # Performs a POST request with the given parameters. See get() for more details. 160 def post(path, parameters =nil, headers=nil)160 def post(path, parameters = nil, headers = nil) 161 161 process :post, path, parameters, headers 162 162 end 163 163 164 164 # Performs a PUT request with the given parameters. See get() for more details. 165 def put(path, parameters =nil, headers=nil)165 def put(path, parameters = nil, headers = nil) 166 166 process :put, path, parameters, headers 167 167 end 168 168 169 169 # Performs a DELETE request with the given parameters. See get() for more details. 170 def delete(path, parameters =nil, headers=nil)170 def delete(path, parameters = nil, headers = nil) 171 171 process :delete, path, parameters, headers 172 172 end 173 173 174 174 # Performs a HEAD request with the given parameters. See get() for more details. 175 def head(path, parameters =nil, headers=nil)175 def head(path, parameters = nil, headers = nil) 176 176 process :head, path, parameters, headers 177 177 end … … 221 221 222 222 # Performs the actual request. 223 def process(method, path, parameters =nil, headers=nil)223 def process(method, path, parameters = nil, headers = nil) 224 224 data = requestify(parameters) 225 225 path = interpret_uri(path) if path =~ %r{://} … … 334 334 end 335 335 end 336 337 336 end 338 337 trunk/actionpack/lib/action_controller/routing.rb
r7421 r7438 1447 1447 end 1448 1448 end 1449