No duplication in just updated #389

Merged
merged 6 commits into from Mar 23, 2012

2 participants

@rthbound

Get the most recent updates through Rubygem model rather than through Version. Eliminate duplication.

@cmeiklejohn cmeiklejohn commented on an outdated diff Jan 24, 2012
app/models/rubygem.rb
@@ -54,6 +54,10 @@ def self.latest(limit=5)
with_one_version.order("created_at desc").limit(limit)
end
+ def self.just_updated(limit=5)
+ with_versions.order("updated_at desc").limit(limit).map { |rg| rg.versions.last }

Ah, I'm not sure I like the implementation of this. The rubygem model should not have a finder class method which returns instances of Version. Also, I don't believe this will scale well or work correctly with gems with a large amount of versions (full table join, limit applied to the joined gems with versions, not to the unique count of gems).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@sferik
RubyGems member

Looking like this is just a few new tests now. Merging...

@sferik sferik merged commit 6496d0e into rubygems:master Mar 23, 2012
@sferik
RubyGems member

Hmmm, it looks like this broke this tests: http://travis-ci.org/rubygems/rubygems.org/builds/934871

Reverting...

@sferik sferik added a commit that referenced this pull request Mar 23, 2012
@sferik sferik Revert #389 ef74620
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment