# File lib/active_record/base.rb, line 847
      def with_scope(method_scoping = {})
        # Dup first and second level of hash (method and params).
        method_scoping = method_scoping.inject({}) do |hash, (method, params)|
          hash[method] = params.dup
          hash
        end

        method_scoping.assert_valid_keys [:find, :create]
        if f = method_scoping[:find]
          f.assert_valid_keys [:conditions, :joins, :offset, :limit, :readonly]
          f[:readonly] = true if !f[:joins].blank? && !f.has_key?(:readonly)
        end

        raise ArgumentError, "Nested scopes are not yet supported: #{scoped_methods.inspect}" unless scoped_methods.nil?

        self.scoped_methods = method_scoping
        yield
      ensure 
        self.scoped_methods = nil
      end