Module: Matic::ClassMethods

Defined in:
lib/matic.rb

Instance Method Summary collapse

Instance Method Details

#collection_nameObject



8
9
10
# File 'lib/matic.rb', line 8

def collection_name
  self.name.tableize
end

#fields(*attrs) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/matic.rb', line 12

def fields(*attrs)
  if attrs.first.is_a? Hash
    attrs.first.each { |n, f| define_accessors(n, f) }
    define_attribute_methods(attrs.first.keys)
  else
    attrs.each { |n| define_accessors(n) }
    define_attribute_methods(attrs)
  end
end