Module: Scopie

Defined in:
lib/scopie.rb,
lib/scopie/version.rb

Defined Under Namespace

Classes: Base, InvalidTypeError, Value

Constant Summary collapse

RESULTS_TO_IGNORE =
[true, false].freeze
VERSION =
'1.1.1'.freeze

Class Method Summary collapse

Class Method Details

.apply_scopes(target, hash, method: nil, scopie: Scopie::Base.new) ⇒ Object

Receives an object where scopes will be applied to.

class GraduationsScopie < Scopie::Base
  has_scope :featured, type: :boolean
  has_scope :by_degree, :by_period
end

class GraduationsController < ApplicationController
  def index
    @graduations = Scopie.apply_scopes(Graduation, method: :index, scopie: GraduationsScopie.new).all
  end
end


24
25
26
# File 'lib/scopie.rb', line 24

def self.apply_scopes(target, hash, method: nil, scopie: Scopie::Base.new)
  scopie.apply_scopes(target, hash, method)
end

.current_scopes(hash, method: nil, scopie: Scopie::Base.new) ⇒ Object

Returns the scopes used in this action.



29
30
31
# File 'lib/scopie.rb', line 29

def self.current_scopes(hash, method: nil, scopie: Scopie::Base.new)
  scopie.current_scopes(hash, method)
end