From 115230e6195115d6200047eb0c3247d3aad82ee7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 14 Mar 2010 15:46:03 -0700 Subject: cleaning up some test warnings Signed-off-by: wycats --- activerecord/lib/active_record/reflection.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'activerecord/lib/active_record/reflection.rb') 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 -- cgit v1.2.3