Permalink
Browse files

Patch existing find_or_initialize_version_from_spec to make size an o…

…ptional parameter.
  • Loading branch information...
1 parent 08a381e commit be5cee7243b70779d8315c4a3d11534c7fdf52ba @cmeiklejohn committed Jul 13, 2011
Showing with 4 additions and 9 deletions.
  1. +1 −1 app/models/pusher.rb
  2. +3 −8 app/models/rubygem.rb
View
2 app/models/pusher.rb
@@ -85,7 +85,7 @@ def pull_spec
def find
@rubygem = Rubygem.find_or_initialize_by_name(spec.name)
- @version = @rubygem.find_or_initialize_version_from_spec_and_size(spec, size)
+ @version = @rubygem.find_or_initialize_version_from_spec(spec, size)
if @version.new_record?
true
View
11 app/models/rubygem.rb
@@ -206,15 +206,10 @@ def yank!(version)
end
end
- def find_or_initialize_version_from_spec_and_size(spec, size)
- version = find_or_initialize_version_from_spec(spec)
- version.size = size
- version
- end
-
- def find_or_initialize_version_from_spec(spec)
- version = self.versions.find_or_initialize_by_number_and_platform(spec.version.to_s, spec.original_platform.to_s)
+ def find_or_initialize_version_from_spec(spec, size = nil)
+ version = self.versions.find_or_initialize_by_number_and_platform(spec.version.to_s, spec.original_platform.to_s)
version.rubygem = self
+ version.size = size if size
version
end

0 comments on commit be5cee7

Please sign in to comment.