aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations.rb
diff options
context:
space:
mode:
authorAdeh DeSandies <adeh@yahoo.com>2008-09-12 18:02:40 +0800
committerrick <technoweenie@gmail.com>2008-09-20 13:46:09 -0700
commitde96a8666d8edc9be57f6146e587a71d23dbeb41 (patch)
tree641cb4fe91bab52207dc25ba16e91006c0044655 /activerecord/lib/active_record/associations.rb
parent22e830f883af0b56de81186c184751b6398d0141 (diff)
downloadrails-de96a8666d8edc9be57f6146e587a71d23dbeb41.tar.gz
rails-de96a8666d8edc9be57f6146e587a71d23dbeb41.tar.bz2
rails-de96a8666d8edc9be57f6146e587a71d23dbeb41.zip
applied patch to fix the associations with blocks in modules bug from an old trac ticket
Diffstat (limited to 'activerecord/lib/active_record/associations.rb')
-rwxr-xr-xactiverecord/lib/active_record/associations.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index d7aa4bfa98..e6491cebd6 100755
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -1026,7 +1026,7 @@ module ActiveRecord
# Create the callbacks to update counter cache
if options[:counter_cache]
cache_column = options[:counter_cache] == true ?
- "#{self.to_s.underscore.pluralize}_count" :
+ "#{self.to_s.demodulize.underscore.pluralize}_count" :
options[:counter_cache]
method_name = "belongs_to_counter_cache_after_create_for_#{reflection.name}".to_sym
@@ -1755,12 +1755,12 @@ module ActiveRecord
def create_extension_modules(association_id, block_extension, extensions)
if block_extension
- extension_module_name = "#{self.to_s}#{association_id.to_s.camelize}AssociationExtension"
+ extension_module_name = "#{self.to_s.demodulize}#{association_id.to_s.camelize}AssociationExtension"
silence_warnings do
- Object.const_set(extension_module_name, Module.new(&block_extension))
+ self.parent.const_set(extension_module_name, Module.new(&block_extension))
end
- Array(extensions).push(extension_module_name.constantize)
+ Array(extensions).push("#{self.parent}::#{extension_module_name}".constantize)
else
Array(extensions)
end