~vcs-imports/rails/trunk

« back to all changes in this revision

Viewing changes to activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb

  • Committer: pratik
  • Date: 2008-04-05 16:25:48 UTC
  • Revision ID: vcs-imports@canonical.com-20080405162548-4r7d7mgyev6r15hn
Ensure HABTM#create and HABTM#build do not load entire association. [Pratik]

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
      end
8
8
 
9
9
      def build(attributes = {})
10
 
        load_target
11
10
        build_record(attributes)
12
11
      end
13
12
 
154
153
          if attributes.is_a?(Array)
155
154
            attributes.collect { |attr| create(attr) }
156
155
          else
157
 
            load_target
158
156
            build_record(attributes, &block)
159
157
          end
160
158
        end