Hello. I`m having trouble associating models in DataMapper. Its really simple, but i just can get the idea.
So, i have 2 tables:
1. Books
-> id
-> title
-> publisher_id
2. Publishers
-> id
-> title
The classes:
class Book
property :id, Serial
property :title, String
property :publisher_id, Integer
end
class Publisher
property :id, Serial
property :title, String
end
So, the question is: How can i connect publisher to book? It is 1-to-1 relationship, and the whole thing supposed to look like this:
p = Book.get(12345).publisher
Sorry, maybe it is stupid. But i just cant figure out what kind of declaration i should use.