simple_record 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/simple_record/active_sdb.rb +5 -2
  2. metadata +3 -3
@@ -598,19 +598,22 @@ module SimpleRecord
598
598
  #puts 'select=' + select.to_s
599
599
  from = options[:from] || domain
600
600
  condition_fields = parse_condition_fields(options[:conditions])
601
- conditions = options[:conditions] ? " WHERE #{build_conditions(options[:conditions])}" : ''
601
+ conditions = options[:conditions] ? "#{build_conditions(options[:conditions])}" : ''
602
602
  order = options[:order] ? " ORDER BY #{options[:order]}" : ''
603
603
  limit = options[:limit] ? " LIMIT #{options[:limit]}" : ''
604
604
  # mix sort by argument (it must present in response)
605
605
  unless order.blank?
606
606
  sort_by, sort_order = sort_options(options[:order])
607
607
  if condition_fields.nil? || !condition_fields.include?(sort_by)
608
- conditions << (conditions.blank? ? " WHERE " : " AND ") << "(#{sort_by} IS NOT NULL)"
608
+ # conditions << (conditions.blank? ? " WHERE " : " AND ") << "(#{sort_by} IS NOT NULL)"
609
+ conditions = (conditions.blank? ? "" : "(#{conditions}) AND ") << "(#{sort_by} IS NOT NULL)"
609
610
  else
610
611
  # puts 'skipping is not null on sort because already there.'
611
612
  end
612
613
 
613
614
  end
615
+ conditions = conditions.blank? ? "" : " WHERE #{conditions}"
616
+ # puts 'CONDITIONS=' + conditions
614
617
  "SELECT #{select} FROM `#{from}`#{conditions}#{order}#{limit}"
615
618
  end
616
619
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 5
8
- - 2
9
- version: 1.5.2
8
+ - 3
9
+ version: 1.5.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Travis Reeder
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-10 00:00:00 -08:00
19
+ date: 2010-11-13 00:00:00 -08:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency