diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-20 15:51:44 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-10-20 15:51:44 -0700 |
commit | 7f444a3db68c9538544f8e38c678a165a00642e3 (patch) | |
tree | d8c86341ece00ab97f746d69fe3cc84bad0a66dd | |
parent | fb835fc1e2d915deed2a1a7bd6d2e14d526897df (diff) | |
download | rails-7f444a3db68c9538544f8e38c678a165a00642e3.tar.gz rails-7f444a3db68c9538544f8e38c678a165a00642e3.tar.bz2 rails-7f444a3db68c9538544f8e38c678a165a00642e3.zip |
roll up weird method to meta programmed method
-rw-r--r-- | activerecord/lib/active_record/base.rb | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 315598fc4b..630bf7fe85 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -972,13 +972,11 @@ module ActiveRecord #:nodoc: super unless all_attributes_exists?(attribute_names) if match.scope? self.class_eval <<-METHOD, __FILE__, __LINE__ + 1 - def self.#{method_id}(*args) # def self.scoped_by_user_name_and_password(*args) - attributes = construct_attributes_from_arguments( # attributes = construct_attributes_from_arguments( - [:#{attribute_names.join(',:')}], args # [:user_name, :password], args - ) # ) - # - scoped(:conditions => attributes) # scoped(:conditions => attributes) - end # end + def self.#{method_id}(*args) # def self.scoped_by_user_name_and_password(*args) + attributes = Hash[[:#{attribute_names.join(',:')}].zip(args)] # attributes = Hash[[:user_name, :password].zip(args)] + # + scoped(:conditions => attributes) # scoped(:conditions => attributes) + end # end METHOD send(method_id, *arguments) end @@ -987,10 +985,6 @@ module ActiveRecord #:nodoc: end end - def construct_attributes_from_arguments(attribute_names, arguments) - Hash[attribute_names.zip(arguments)] - end - # Similar in purpose to +expand_hash_conditions_for_aggregates+. def expand_attribute_names_for_aggregates(attribute_names) expanded_attribute_names = [] |