generate 10 UUID records and save it it database in rails

I need to create certain number of UUId records(based on the selection
of drop down) and save it in the database. Now I am generating only one
unique id. Can this be done in the model in this way. Or do I need to
write a helper file for that??

def generate_unique_token=(value) self.secret =
Base64.encode64(UUIDTools::UUID.random_create)[0..8] end

In my controller...........

def create
     if @secretcode.valid?
        redirect_to secretcodes_path
       render 'new'
     end end

In my view page

before_save :guarantee_uuid!

def uuid
  if !uuid_field?
    write_attribute :uuid_field, # UUID CODE HERE

That is how I would personally do it, put it all in a method and
trigger it with before_save, this also gives you the option to
generate the UUID and modify/add it in other places too.