Skip to content

Commit

Permalink
Minor style tweaks
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4355 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
dhh committed May 21, 2006
1 parent 66586bc commit b5a6ba6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def size
if loaded? && !@reflection.options[:uniq]
@target.size
elsif !loaded? && !@reflection.options[:uniq] && @target.is_a?(Array)
unsaved_records = Array(@target.detect { |r| r.new_record? }).size
unsaved_records + count_records
unsaved_records = Array(@target.detect { |r| r.new_record? })
unsaved_records.size + count_records
else
count_records
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ def build(attributes = {})
record = @reflection.klass.new(attributes)
set_belongs_to_association_for(record)

if loaded?
@target << record
else
@target ||= []
@target << record
end
@target ||= [] unless loaded?
@target << record

record
end
Expand Down

0 comments on commit b5a6ba6

Please sign in to comment.