Created
September 27, 2009 15:54
-
-
Save knowtheory/194831 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'dm-core' | |
| require 'dm-aggregates' | |
| DataMapper::Logger.new(STDOUT, :debug) | |
| DataMapper.setup(:default, "mysql://localhost/dm_specs") | |
| class CrawledPage | |
| include DataMapper::Resource | |
| property :id, Serial | |
| belongs_to :crawling_run | |
| end | |
| class CrawlingRun | |
| include DataMapper::Resource | |
| property :id, Serial | |
| belongs_to :board_account | |
| has n, :crawled_pages | |
| end | |
| class BoardAccount | |
| include DataMapper::Resource | |
| property :id, Serial | |
| belongs_to :board | |
| belongs_to :recruiter, :nullable => true | |
| has n, :crawling_runs | |
| end | |
| class Recruiter | |
| include DataMapper::Resource | |
| property :id, Serial | |
| has n, :board_accounts | |
| end | |
| DataMapper.auto_migrate! | |
| CrawledPage.count('crawling_run.board_account.board_id' => 'board1') # pulled from email and explodes | |
| CrawledPage.count('crawling_run.board_account.recruiter.id' => 'board1') # works | |
| CrawledPage.count('crawling_run.board_account.id' => 'board1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment