Sha256: d07842827a90d9b417e1c037ae3e235e17537677ec5ba7235974c7bbd5c870a9
Contents?: true
Size: 774 Bytes
Versions: 6
Compression:
Stored size: 774 Bytes
Contents
module Effective module EffectiveDatatable module Dsl module Scopes # Instance Methods inside the scopes do .. end block def scope(name, default = :klass_scope, options = {}, &block) if block_given? raise "You cannot use partial: ... with the block syntax" if options[:partial] options[:block] = block end if default == :klass_scope || default == { default: true } options[:klass_scope] = true default = (default == :klass_scope ? nil : true) end # This needs to be a {} not WithIndifferentAccess or rendering _scopes won't work correctly (@scopes ||= {})[name] = options.merge(default: default) end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems