Skip to content

Commit

Permalink
arel sql syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrock committed Jun 12, 2011
1 parent d6347ec commit 0d15b6a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -14,6 +14,7 @@ gem 'haml', '3.1.2'
gem 'rdoc', '2.4.3'
gem 'erubis'
gem 'rails_xss'
gem 'fake_arel'

group :test do
gem 'factory_girl'
Expand Down
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -15,6 +15,8 @@ GEM
crack (0.1.8)
erubis (2.7.0)
factory_girl (1.3.3)
fake_arel (0.9.9)
activerecord (>= 2.3.5)
faraday (0.6.1)
addressable (~> 2.2.4)
multipart-post (~> 1.1.0)
Expand Down Expand Up @@ -63,6 +65,7 @@ DEPENDENCIES
crack (= 0.1.8)
erubis
factory_girl
fake_arel
haml (= 3.1.2)
httparty (~> 0.7.8)
mash (= 0.1.1)
Expand Down
8 changes: 3 additions & 5 deletions app/models/tweet.rb
Expand Up @@ -23,13 +23,11 @@ def build_by_value(username, value)

validates_uniqueness_of :status_id

named_scope :recent_first, ('status_at desc')

#TODO: Re tagless: should we even store entries w/o a tag?
#TODO: maybe we shouldn't even store the from user in tweet
named_scope :recent, :order => 'status_at desc', :limit => 5,
:include => :tweet_tags,
:conditions => {:tagless => false}

named_scope :recent_first, :order => 'status_at desc'
named_scope :recent, where(:tagless => false).includes(:tweet_tags).order('status_at desc').limit(5)

class << self
# Find the latest (most recent) Twitter status ID that we've fetched.
Expand Down

0 comments on commit 0d15b6a

Please sign in to comment.