appoxy-simple_record 1.0.28 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/simple_record.rb CHANGED
@@ -844,33 +844,30 @@ This is done on getters now
844
844
 
845
845
  def self.find(*params)
846
846
  #puts 'params=' + params.inspect
847
- reload=true
848
- first=false
849
- all=false
850
- select=false
847
+ q_type = :all
851
848
  select_attributes=[]
852
849
 
853
850
  if params.size > 0
854
- all = params[0] == :all
855
- first = params[0] == :first
851
+ q_type = params[0]
856
852
  end
857
853
 
858
-
859
854
  # Pad and Offset number attributes
860
855
  options = {}
861
856
  if params.size > 1
862
857
  options = params[1]
863
858
  #puts 'options=' + options.inspect
864
859
  #puts 'after collect=' + options.inspect
860
+ convert_condition_params(options)
865
861
  end
866
- convert_condition_params(options)
867
862
  #puts 'params2=' + params.inspect
868
863
 
869
- results = all ? [] : nil
864
+ results = q_type == :all ? [] : nil
870
865
  begin
871
866
  results=super(*params)
872
- cache_results(results)
873
- results = SimpleRecord::ResultsArray.new(self, params, results, next_token)
867
+ if q_type != :count
868
+ cache_results(results)
869
+ results = SimpleRecord::ResultsArray.new(self, params, results, next_token)
870
+ end
874
871
  rescue RightAws::AwsError, RightAws::ActiveSdb::ActiveSdbError
875
872
  puts "RESCUED: " + $!.message
876
873
  if ($!.message().index("NoSuchDomain") != nil)
@@ -169,6 +169,11 @@ class TestSimpleRecord < Test::Unit::TestCase
169
169
 
170
170
  end
171
171
 
172
+ def test_count
173
+ count = MyModel.find(:count)
174
+ assert count > 0
175
+ end
176
+
172
177
  def test_attributes_correct
173
178
 
174
179
  #MyModel.defined_attributes.each do |a|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appoxy-simple_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.28
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder