diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-03 22:23:11 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-12-03 22:23:12 -0200 |
commit | 3b40a5d83db90534b3cb61f4dc25547f501e4775 (patch) | |
tree | 49795acfdaaf3c5b468ddcbea474709cabf54b2e /actionpack/lib/action_controller/metal | |
parent | bc26f442d2ef31facc493f4db518f6e104a4f14d (diff) | |
download | rails-3b40a5d83db90534b3cb61f4dc25547f501e4775.tar.gz rails-3b40a5d83db90534b3cb61f4dc25547f501e4775.tar.bz2 rails-3b40a5d83db90534b3cb61f4dc25547f501e4775.zip |
Improve a couple exception messages related to variants and mime types
Avoid one-liner conditionals when they are too big. Avoid concatenating
strings to build error messages. Improve messages a bit.
Diffstat (limited to 'actionpack/lib/action_controller/metal')
-rw-r--r-- | actionpack/lib/action_controller/metal/mime_responds.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/mime_responds.rb b/actionpack/lib/action_controller/metal/mime_responds.rb index 0d28409aaa..54d3be68f0 100644 --- a/actionpack/lib/action_controller/metal/mime_responds.rb +++ b/actionpack/lib/action_controller/metal/mime_responds.rb @@ -348,8 +348,10 @@ module ActionController #:nodoc: # 2. <tt>:action</tt> - overwrites the default render action used after an # unsuccessful html +post+ request. def respond_with(*resources, &block) - raise "In order to use respond_with, first you need to declare the formats your " \ - "controller responds to in the class level" if self.class.mimes_for_respond_to.empty? + if self.class.mimes_for_respond_to.empty? + raise "In order to use respond_with, first you need to declare the " \ + "formats your controller responds to in the class level." + end if collector = retrieve_collector_from_mimes(&block) options = resources.size == 1 ? {} : resources.extract_options! |