diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-07-13 17:40:26 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-07-13 17:40:26 +0100 |
commit | 35edd185e15cf23546ff055a1e1d65d6b804dc1a (patch) | |
tree | aca0cd55b883c7d90568da402dc766d380d37b97 | |
parent | 65843e1acc0c8d285ff79f8c9c49d4d1215440be (diff) | |
download | rails-35edd185e15cf23546ff055a1e1d65d6b804dc1a.tar.gz rails-35edd185e15cf23546ff055a1e1d65d6b804dc1a.tar.bz2 rails-35edd185e15cf23546ff055a1e1d65d6b804dc1a.zip |
extract deprecated association options to active_record_deprecated_finders
-rw-r--r-- | activerecord/lib/active_record/associations/builder/association.rb | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/activerecord/lib/active_record/associations/builder/association.rb b/activerecord/lib/active_record/associations/builder/association.rb index fd939ab9ba..f1a9f254b1 100644 --- a/activerecord/lib/active_record/associations/builder/association.rb +++ b/activerecord/lib/active_record/associations/builder/association.rb @@ -22,49 +22,6 @@ module ActiveRecord::Associations::Builder else @scope = nil @options = scope - - convert_deprecated_options_to_scope! - end - end - - # FIXME: references should not be in this list - DEPRECATED_OPTIONS = [:readonly, :references, :order, :limit, :joins, :group, :having, - :offset, :select, :uniq, :include, :conditions] - - class DeprecatedOptionsProc - attr_reader :options - - def initialize(options) - @options = options - end - - def to_proc - options = self.options - proc do |owner| - if options[:where].respond_to?(:to_proc) - context = owner || self - where(context.instance_eval(&options[:where])) - .merge!(options.except(:where)) - else - scoped(options) - end - end - end - - def arity - 1 - end - end - - def convert_deprecated_options_to_scope! - deprecated_options = options.slice(*DEPRECATED_OPTIONS) - - unless deprecated_options.empty? - deprecated_options[:includes] = deprecated_options.delete(:include) if deprecated_options[:include] - deprecated_options[:where] = deprecated_options.delete(:conditions) if deprecated_options[:conditions] - - @scope = DeprecatedOptionsProc.new(deprecated_options) - @options = options.except(*DEPRECATED_OPTIONS) end end |