diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-12-26 12:57:34 +0530 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-12-26 12:57:34 +0530 |
commit | 187fbe5cbadf9d6fe5009a4a436fac28bcf8c99c (patch) | |
tree | ef880781f965fab4c0312fb41865d83ab75ec144 /activerecord/lib | |
parent | 5f5aa44d2de9e7d93087d52862502c12722bdae3 (diff) | |
download | rails-187fbe5cbadf9d6fe5009a4a436fac28bcf8c99c.tar.gz rails-187fbe5cbadf9d6fe5009a4a436fac28bcf8c99c.tar.bz2 rails-187fbe5cbadf9d6fe5009a4a436fac28bcf8c99c.zip |
Add support for multiple arguments to .where finder
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/relation.rb b/activerecord/lib/active_record/relation.rb index 9aa45fb294..40ccdd4696 100644 --- a/activerecord/lib/active_record/relation.rb +++ b/activerecord/lib/active_record/relation.rb @@ -98,8 +98,13 @@ module ActiveRecord create_new_relation(join) end - def where(conditions) - conditions = @klass.send(:merge_conditions, conditions) if [String, Hash, Array].include?(conditions.class) + def where(*args) + if [String, Hash, Array].include?(args.first.class) + conditions = @klass.send(:merge_conditions, args.size > 1 ? Array.wrap(args) : args.first) + else + conditions = args.first + end + create_new_relation(@relation.where(conditions)) end |