Permalink
Browse files

Accepts string conditions (non array)

  • Loading branch information...
1 parent a99faf3 commit 2c8eff806c19d8c56dd39eac920b07e91124b13e @treeder treeder committed Jan 13, 2011
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/simple_record.rb
View
@@ -861,6 +861,11 @@ def self.find(*params)
if params.size > 1
options = params[1]
end
+ conditions = options[:conditions]
+ if conditions && conditions.is_a?(String)
+ conditions = [conditions]
+ options[:conditions] = conditions
+ end
if !options[:shard_find] && is_sharded?
# then break off and get results across all shards
@@ -958,7 +963,8 @@ def self.paginate(options={})
def self.convert_condition_params(options)
return if options.nil?
conditions = options[:conditions]
- if !conditions.nil? && conditions.size > 1
+ return if conditions.nil?
+ if conditions.size > 1
# all after first are values
conditions.collect! { |x|
Translations.pad_and_offset(x)

0 comments on commit 2c8eff8

Please sign in to comment.