Class: Option

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/lokka/option.rb

Class Method Summary collapse

Class Method Details

.method_missing(method, *args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/lokka/option.rb', line 11

def self.method_missing(method, *args)
  attribute = method.to_s
  if attribute =~ /=$/
    column = attribute[0, attribute.size - 1]
    o = self.first_or_new(:name => column)
    o.value = args.first
    o.save
  else
    o = self.first_or_new(:name => method)
    o.value
  end
end