Created
March 5, 2009 12:53
-
-
Save collin/74343 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
| class SubjectTweet | |
| include DataMapper::Resource | |
| property :subject_id, Integer, :key => true | |
| property :tweet_id, String, :key => true | |
| property :created_at, DateTime, :index => true | |
| def self.default_storage_name; 'subjects_tweet' end | |
| def find_or_create_for_tweet_and_subject tweet, subject | |
| SubjectTweet.first(:tweet_id => tweet.id, :subject_id => subject.id) || | |
| SubjectTweet.create( | |
| :tweet_id => tweet.id, | |
| :subject_id => subject.id, | |
| :created_at => tweet.created_at) | |
| end | |
| def self.tweets params | |
| Tweet.get all(params).map{|one| one.tweet_id } | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment