Creating a parent with grandparent_id from grandchild model

Hi,

I have a situation where I have mapping table to link two models
(effectively linking a grandparent and grandchild with a child and
parent respectively)

Here are the models:

class Town < ActiveRecord::Base
has_many :venues
end

class Venue < ActiveRecord::Base
has_many :venue_aliases
belongs_to :town
validates_presence_of :town
end

class VenueAlias < ActiveRecord::Base
belongs_to :venue
end

The list of towns already exists and is ultimately fixed, and for each
new venue_alias a venue must be assigned or created (with a town_id) and
assigned.

I would like to do this all in one form, preferably with a nice
autocomplete so that the user can either:

  1. Enter the venue name and where it already exists assign the venue_id
    to the venue alias

or

  1. Enter the venue name and a town name, so that the new venue/town_id
    combo is created and subsequently the new venue_id is assigned to the
    venue_alias

I’ve been through Ryan B.’ screencasts but they generally deal with
creating children at the same time as parents, so is there a way of
doing it the other way around as it were?

Thanks in advance…