Module: RecordWithOperator::Extension::InstanceMethods

Defined in:
lib/record_with_operator/extension.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object (private)



117
118
119
120
121
122
123
124
125
126
# File 'lib/record_with_operator/extension.rb', line 117

def method_missing(method, *args)
  return super unless respond_to?(method)
  case method.to_sym
  when :creator, :updater, :deleter
    self.class.create_operator_associations
    send(method, *args)
  else
    super
  end
end

Instance Method Details

#respond_to?(name, priv = false) ⇒ Boolean

Returns:

  • (Boolean)


99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/record_with_operator/extension.rb', line 99

def respond_to?(name, priv=false)
  case name.to_sym
  when :creator
    respond_to? :created_by
  when :updater
    respond_to? :updated_by
  when :deleter
    respond_to? :deleted_by
  else
    super
  end
end