Module: Anaconda::Model::InstanceMethods

Defined in:
lib/anaconda/anaconda_for.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/anaconda/anaconda_for.rb', line 44

def method_missing(method, *args, &block)
  checking_column = checking_method = nil
  if self.class.anaconda_columns.present? && self.class.anaconda_columns.any? do |column|
      checking_column = column
      Anaconda::MagicMethods.any? do |magic_method|
        checking_method = magic_method
        "#{column.to_s}_#{magic_method.to_s}" == method.to_s
      end
    end
    case checking_method
    when :url
      magic_url(checking_column)
    else
      super
    end
  else
    super
  end
end