Module: HasOneAutocreate::ClassMethods

Defined in:
lib/has_one_autocreate.rb

Overview

TODO: alias_method_chainize these

Instance Method Summary collapse

Instance Method Details

#has_one(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/has_one_autocreate.rb', line 9

def has_one(*args)
  options = args.extract_options!
  autocreate = options.delete(:autocreate)
  args << options
  super(*args)
  
  if autocreate
    reflections[args.first].send "autocreate=", autocreate
  end
end