Sha256: d5d747fbcc1c7ee742b7b389b610b2091b989c4ab38e2ad56d92d30ac84b1dce

Contents?: true

Size: 527 Bytes

Versions: 4

Compression:

Stored size: 527 Bytes

Contents

require 'active_support'
require_relative 'node'
require_relative 'builder'

module ActiveRecordNestedScope
  module Extension
    extend ActiveSupport::Concern

    included do
      class_attribute :nested_scope_options
    end

    class_methods do
      def nested_scope(name, options = {})
        self.nested_scope_options ||= {}
        self.nested_scope_options[name] = options

        scope name, ->(args) {
          ActiveRecordNestedScope::Builder.new(self, name, args).build
        }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord_nested_scope-1.3.0 lib/activerecord_nested_scope/extension.rb
activerecord_nested_scope-1.2.0 lib/activerecord_nested_scope/extension.rb
activerecord_nested_scope-1.1.1 lib/activerecord_nested_scope/extension.rb
activerecord_nested_scope-1.1.0 lib/activerecord_nested_scope/extension.rb