Don't call attr_readonly on polymorphic belongs_to associations, in case it matches the name of some other non-ActiveRecord class/module. [Rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7748 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
58a5eef53e
commit
24c2457a26
@ -1,5 +1,7 @@
|
||||
*SVN*
|
||||
|
||||
* Don't call attr_readonly on polymorphic belongs_to associations, in case it matches the name of some other non-ActiveRecord class/module. [Rick]
|
||||
|
||||
* Try loading activerecord-<adaptername>-adapter gem before trying a plain require so you can use custom gems for the bundled adapters. Also stops gems from requiring an adapter from an old Active Record gem. [Jeremy Kemper, Derrick Spell]
|
||||
|
||||
|
||||
|
@ -844,7 +844,7 @@ def belongs_to(association_id, options = {})
|
||||
)
|
||||
|
||||
module_eval(
|
||||
"#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name})"
|
||||
"#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name}) && #{reflection.class_name}.respond_to?(:attr_readonly)"
|
||||
)
|
||||
end
|
||||
end
|
||||
|
4
activerecord/test/fixtures/tagging.rb
vendored
4
activerecord/test/fixtures/tagging.rb
vendored
@ -1,3 +1,7 @@
|
||||
# test that attr_readonly isn't called on the :taggable polymorphic association
|
||||
module Taggable
|
||||
end
|
||||
|
||||
class Tagging < ActiveRecord::Base
|
||||
belongs_to :tag, :include => :tagging
|
||||
belongs_to :super_tag, :class_name => 'Tag', :foreign_key => 'super_tag_id'
|
||||
|
Loading…
Reference in New Issue
Block a user