diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 08:32:47 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-09 08:32:47 +0000 |
commit | 0439769324ef889e5e353caacb92a025a8ce2629 (patch) | |
tree | 751d9335a145f92d2b2da24957de0ba5760d2e41 /actionpack/lib | |
parent | 558331596fbf9139ef529b14d50c6e258e63fb67 (diff) | |
download | rails-0439769324ef889e5e353caacb92a025a8ce2629.tar.gz rails-0439769324ef889e5e353caacb92a025a8ce2629.tar.bz2 rails-0439769324ef889e5e353caacb92a025a8ce2629.zip |
Refactored away all the legacy validate_options calls and replaced them with Hash#assert_valid_keys
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2167 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/scaffolding.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/actionpack/lib/action_controller/scaffolding.rb b/actionpack/lib/action_controller/scaffolding.rb index 990ec3d2ea..f79a21a173 100644 --- a/actionpack/lib/action_controller/scaffolding.rb +++ b/actionpack/lib/action_controller/scaffolding.rb @@ -82,7 +82,7 @@ module ActionController # make <tt>scaffold :post, :suffix => true</tt> use method names like list_post, show_post, and create_post # instead of just list, show, and post. If suffix is used, then no index method is added. def scaffold(model_id, options = {}) - validate_options([ :class_name, :suffix ], options.keys) + options.assert_valid_keys(:class_name, :suffix) singular_name = model_id.to_s class_name = options[:class_name] || singular_name.camelize @@ -176,14 +176,7 @@ module ActionController caller.first.scan(/`(.*)'/).first.first # ' ruby-mode end end_eval - end - - private - # Raises an exception if an invalid option has been specified to prevent misspellings from slipping through - def validate_options(valid_option_keys, supplied_option_keys) - unknown_option_keys = supplied_option_keys - valid_option_keys - raise(ActionController::ActionControllerError, "Unknown options: #{unknown_option_keys}") unless unknown_option_keys.empty? - end + end end end end |