Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 21:13:34 enl@isengard:~/tmp/cats> sequel -E sqlite://test.db -L .
- ./init.rb:5: warning: already initialized constant DB
- I, [2009-10-25T21:13:49.577548 #2382] INFO -- : PRAGMA table_info('chapters')
- I, [2009-10-25T21:13:49.579738 #2382] INFO -- : PRAGMA table_info('categories')
- I, [2009-10-25T21:13:49.581778 #2382] INFO -- : PRAGMA table_info('posts')
- Your database is stored in DB...
- 001:0> p = Chapter.eager(:categories).all
- I, [2009-10-25T21:14:07.951787 #2382] INFO -- : SELECT * FROM `chapters`
- I, [2009-10-25T21:14:07.953633 #2382] INFO -- : SELECT * FROM `categories` WHERE (`categories`.`chapter_id` IN (1, 2))
- [#<Chapter @values={:id=1, :text="ch1"}, #<Chapter @values={:id=>2, :text=>"ch2"}]
- 002:0> p.each {|x| x.categories.each {|y| puts y.text}}
- [#<Chapter @values={:id=1, :text="ch1"}, #<Chapter @values={:id=>2, :text=>"ch2"}]
- 003:0>
Add Comment
Please, Sign In to add comment