aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorMike Dillon <mike@embody.org>2013-05-16 11:11:27 -0700
committerMike Dillon <mike@embody.org>2013-05-16 11:28:31 -0700
commit2d7a86e17947e359cb65653b987c666b2d7e8efb (patch)
tree27c570e652cf25e6118b2894b6599b0dc81fb393 /activesupport/lib
parentf96478369e0e01a00d1d6909814d388c49642b1a (diff)
downloadrails-2d7a86e17947e359cb65653b987c666b2d7e8efb.tar.gz
rails-2d7a86e17947e359cb65653b987c666b2d7e8efb.tar.bz2
rails-2d7a86e17947e359cb65653b987c666b2d7e8efb.zip
Raise when multiple included blocks are defined
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/concern.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/concern.rb b/activesupport/lib/active_support/concern.rb
index eeeba60839..b6ae86b583 100644
--- a/activesupport/lib/active_support/concern.rb
+++ b/activesupport/lib/active_support/concern.rb
@@ -98,6 +98,12 @@ module ActiveSupport
# include Bar # works, Bar takes care now of its dependencies
# end
module Concern
+ class MultipleIncludedBlocks < StandardError #:nodoc:
+ def initialize
+ super "Cannot define multiple 'included' blocks for a Concern"
+ end
+ end
+
def self.extended(base) #:nodoc:
base.instance_variable_set("@_dependencies", [])
end
@@ -117,6 +123,8 @@ module ActiveSupport
def included(base = nil, &block)
if base.nil?
+ raise MultipleIncludedBlocks if instance_variable_defined?("@_included_block")
+
@_included_block = block
else
super