Add existing models to a relation using nested attributes
Couple of things to improve here:

Firstly - do not use fixtures, use factories. There is a neat library allowing you to do this with ease called FactoryGirl (for rails you will need FactoryGirlRails). Having this in place you can define factories like:

FactoryGirl.define do
  factory :thumbnail do
    name 'Thumbnail name if you have such a field'
    other_field :other_value
  end
end


And then use it as:

thumbnail = FactoryGirl.create :thumbnail


One advantage of factories is that it does not load all the data into the database for each test, but rather allows you tell it what is needed instead. 

There are quite a lot of options you can add to your factories, like dynamic field values (useful when you have uniqueness validations), building parameters, building associated objects etc. All are well documented on gem github wiki.

Secondly, accepts_nested_attributes_for already provides you with a method to assign objects using their ids:

@model.children_ids &lt;&lt; [1,2,3]


or even modify the whole association in one go

@model.children_ids = [1,2,3]


This is usually more useful in terms of web forms. If you have a form where client can select multiple objects from a list from db, all you need to do is to name those fields children_ids and rails will take care of persisting the association.