Class: Kms::ModelsWrapper

Inherits:
Object
  • Object
show all
Includes:
Liquor::Dropable
Defined in:
app/models/kms/models_wrapper.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object



5
6
7
8
# File 'app/models/kms/models_wrapper.rb', line 5

def method_missing(name, *args, &block)
  model = Kms::Model.find_by(collection_name: name.to_s)
  model ? model.entries.order('position') : super
end

Instance Method Details

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'app/models/kms/models_wrapper.rb', line 10

def respond_to_missing?(method_name, include_private = false)
  Kms::Model.where(collection_name: method_name.to_s).exists? || super
end