Module: ActiveHouse::Scopeable

Extended by:
ActiveSupport::Concern
Included in:
Query
Defined in:
lib/active_house/scopeable.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &_block) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/active_house/scopeable.rb', line 34

def method_missing(method_name, *args, &_block)
  if scope?(method_name)
    apply_scope(method_name, *args)
  else
    super
  end
end

Instance Method Details

#initializeObject



25
26
27
28
# File 'lib/active_house/scopeable.rb', line 25

def initialize(*)
  super
  with_current_query { apply_default_scope }
end

#respond_to_missing?(method_name, *_args) ⇒ Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/active_house/scopeable.rb', line 30

def respond_to_missing?(method_name, *_args)
  scope?(method_name) || super
end