From e8b427cdefd9ec851e2853d4bf21dd8fd676096d Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Thu, 6 Oct 2005 22:21:10 +0000 Subject: Raise an exception when invalid options are passed to ActiveRecord::Base.find. Closes #2363. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2481 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/base.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 1c063c003d..8d7a49e46b 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -975,7 +975,13 @@ module ActiveRecord #:nodoc: end def extract_options_from_args!(args) - if args.last.is_a?(Hash) then args.pop else {} end + options = args.last.is_a?(Hash) ? args.pop : {} + validate_find_options(options) + options + end + + def validate_find_options(options) + options.assert_valid_keys [:conditions, :include, :joins, :limit, :offset, :order, :select] end def encode_quoted_value(value) -- cgit v1.2.3