Skip to content

Commit

Permalink
Scanner now fetches with limit of 100000000 instead of 10.
Browse files Browse the repository at this point in the history
I tried max fixnum number but I got an internal scanner error or
something. Tried nil as well, but that didn't quite help =) Maybe
there is another way of doing it which is better, but this will work for
now...

This "fixes"
https://github.com/CompanyBook/massive_record/issues#issue/19
  • Loading branch information
thhermansen committed Feb 15, 2011
1 parent 66d097a commit 4d23ad8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/massive_record/wrapper/scanner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def initialize(connection, table_name, column_family_names, opts = {})
@start_key = opts[:start_key].to_s
@offset_key = opts[:offset_key].to_s
@created_at = opts[:created_at].to_s
@limit = opts[:limit] || 10
@limit = opts[:limit] || 100000000

end

def key
Expand Down Expand Up @@ -58,4 +59,4 @@ def populate_row(result)

end
end
end
end
5 changes: 5 additions & 0 deletions spec/orm/cases/finders_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
all.should include @person, @bob
all.length.should == 2
end

it "should find all persons, even if it is more than 10" do
15.times { |i| Person.create! :id => "id-#{i}", :name => "Going to die :-(", :age => i + 20 }
Person.all.length.should > 10
end
end

describe "#find_in_batches" do
Expand Down
6 changes: 6 additions & 0 deletions spec/orm/cases/persistence_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@
it "should return an array of all removed objects" do
Person.destroy_all.should == [@person]
end

it "should destroy all even if it is above 10 rows (obviously)" do
15.times { |i| Person.create! :id => "id-#{i}", :name => "Going to die :-(", :age => i + 20 }
Person.destroy_all
Person.all.length.should == 0
end
end
end
end
Expand Down

0 comments on commit 4d23ad8

Please sign in to comment.