1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Loading development environment (Rails 2.1.2)
>> a = Author.find(10000)
=> #<Author id: 10000, first_name: "Chunk", last_name: "Noris", phone: nil, address: nil, created_at
: "2008-11-08 21:44:49", updated_at: "2008-11-10 21:28:06", book_id: 10000>
>> a.books
=> [#<Book id: 10000, title: "Chalala", description: nil, pages: nil, author_id: 10000, publisher_id
: nil, image: nil, created_at: "2008-11-08 21:44:50", updated_at: "2008-11-08 21:45:32">]
>> a.books[0]
=> #<Book id: 10000, title: "Chalala", description: nil, pages: nil, author_id: 10000, publisher_id:
nil, image: nil, created_at: "2008-11-08 21:44:50", updated_at: "2008-11-08 21:45:32">
>> a.books[0].author
=> #<Author id: 10000, first_name: "Chunk", last_name: "Noris", phone: nil, address: nil, created_at
: "2008-11-08 21:44:49", updated_at: "2008-11-10 21:28:06", book_id: 10000>
>> |