Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 7748

Show
Ignore:
Timestamp:
10/05/07 19:27:33 (1 year ago)
Author:
rick
Message:

Don't call attr_readonly on polymorphic belongs_to associations, in case it matches the name of some other non-ActiveRecord class/module. [Rick]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r7735 r7748  
    11*SVN* 
     2 
     3* Don't call attr_readonly on polymorphic belongs_to associations, in case it matches the name of some other non-ActiveRecord class/module.  [Rick] 
    24 
    35* 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] 
  • trunk/activerecord/lib/active_record/associations.rb

    r7693 r7748  
    845845           
    846846          module_eval( 
    847             "#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name})
     847            "#{reflection.class_name}.send(:attr_readonly,\"#{cache_column}\".intern) if defined?(#{reflection.class_name}) && #{reflection.class_name}.respond_to?(:attr_readonly)
    848848          ) 
    849849        end 
  • trunk/activerecord/test/fixtures/tagging.rb

    r3974 r7748  
     1# test that attr_readonly isn't called on the :taggable polymorphic association 
     2module Taggable 
     3end 
     4 
    15class Tagging < ActiveRecord::Base 
    26  belongs_to :tag, :include => :tagging