Module: DataMapper::Associations::ManyToOne

Defined in:
lib/autumn/datamapper_hacks.rb

Overview

:nodoc:

Class Method Summary collapse

Class Method Details

.old_setupObject



52
# File 'lib/autumn/datamapper_hacks.rb', line 52

alias_method :old_setup, :setup

.setup(name, model, options = {}) ⇒ Object



53
54
55
56
57
58
59
60
61
62
# File 'lib/autumn/datamapper_hacks.rb', line 53

def setup(name, model, options={})
  class_name = options.fetch(:class_name, Extlib::Inflection.classify(name))
  if not options[:old_behavior] and not class_name.include?('::') then
    modules = model.to_s.split('::')
    modules.pop
    modules << class_name
    options[:class_name] = modules.join('::')
  end
  old_setup(name, model, options)
end