Skip to content

Commit

Permalink
need to add extension_module after cloning in has_set
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjudd committed Sep 12, 2012
1 parent d2f259f commit 20b3c0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/model_set.rb
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,9 @@ def set.parent_model
if options[:clone] == false or args.include?(:no_clone)
@model_set_cache[name]
else
@model_set_cache[name].clone
set = @model_set_cache[name].clone
set.extend(extension_module) if extension_module
set
end
end

Expand Down
1 change: 1 addition & 0 deletions test/model_set_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ def add_birthday!
underdog = Superpet.create(:name => 'Underdog', :owner_id => hero.id, :species => 'dog')

set = hero.pets

assert_equal ['mouse', 'dog', 'dog'], set.collect {|pet| pet.species}

assert_equal [sammy.id, underdog.id], set.dogs!.ids
Expand Down

0 comments on commit 20b3c0d

Please sign in to comment.