diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2010-03-15 19:46:03 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2010-03-15 19:46:03 +0000 |
commit | 03a62f4afedbef8bda72c8fdf9a0092273c0f2b0 (patch) | |
tree | 2155b65750757d26e3c8c8e0655ad32cc89d6c2e /activerecord/lib/active_record/reflection.rb | |
parent | f53fddf3665e6582768f4ab0c82b286b39e7fb19 (diff) | |
parent | a594a22267bfd3346e00923742c4aa7edad0cef7 (diff) | |
download | rails-03a62f4afedbef8bda72c8fdf9a0092273c0f2b0.tar.gz rails-03a62f4afedbef8bda72c8fdf9a0092273c0f2b0.tar.bz2 rails-03a62f4afedbef8bda72c8fdf9a0092273c0f2b0.zip |
Merge remote branch 'mainstream/master'
Diffstat (limited to 'activerecord/lib/active_record/reflection.rb')
-rw-r--r-- | activerecord/lib/active_record/reflection.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb index 32b9a2aa87..5e8fc104cb 100644 --- a/activerecord/lib/active_record/reflection.rb +++ b/activerecord/lib/active_record/reflection.rb @@ -154,6 +154,11 @@ module ActiveRecord @klass ||= active_record.send(:compute_type, class_name) end + def initialize(macro, name, options, active_record) + super + @collection = [:has_many, :has_and_belongs_to_many].include?(macro) + end + # Returns a new, unsaved instance of the associated class. +options+ will # be passed to the class's constructor. def build_association(*options) @@ -256,9 +261,6 @@ module ActiveRecord # association. Returns +true+ if the +macro+ is one of +has_many+ or # +has_and_belongs_to_many+, +false+ otherwise. def collection? - if @collection.nil? - @collection = [:has_many, :has_and_belongs_to_many].include?(macro) - end @collection end |