All

I have the following migration ...

<<
# Sequel migration that creates the books, authors, and authors_books.
Class.new(Sequel::Migration) do
    def up
        create_table(:books) do
            primary_key :id
            String :title
        end

        create_table(:authors) do
            primary_key :id
            String :first_name
            String :last_name
        end

        create_table(:authors_books) do
            primary_key :id
            foreign_key :author_id, :authors
            foreign_key :book_id, :books
        end

        # Create a library administrator.
        from(:books).insert(:title => 'Programming Ruby')
        from(:authors).insert(:first_name => 'Dave', :last_name => 'Thomas')

    end

    def down
        drop_table(:books, :authors, :authors_books)
    end
end

>>

and I want to hook the book (Programming Ruby) with the author (Dave Thomas)
in the authors_books table. The documentation says not to use models (pretty
emphatically) which would be how I'd normally do this. Actually, I wouldn't
normally do this at all, this is just to save myself a bunch of irrelevant
coding elsewhere.

Thoughts?


-- 
Scott
http://steamcode.blogspot.com/

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to