Class: SchemaPlus::Config

Inherits:
Valuable
  • Object
show all
Defined in:
lib/schema_plus.rb

Overview

This global configuation options for SchemaPlus. Set them in config/initializers/schema_plus.rb using:

SchemaPlus.setup do |config|
   ...
end

The options are grouped into subsets based on area of functionality. See Config::ForeignKeys

Defined Under Namespace

Classes: ForeignKeys

Instance Method Summary collapse

Instance Method Details

#dupObject

:nodoc:



85
86
87
# File 'lib/schema_plus.rb', line 85

def dup #:nodoc:
  self.class.new(Hash[attributes.collect{ |key, val| [key, Valuable === val ?  val.class.new(val.attributes) : val] }])
end

#merge(opts) ⇒ Object

:nodoc:



96
97
98
# File 'lib/schema_plus.rb', line 96

def merge(opts)#:nodoc:
  dup.update_attributes(opts)
end

#update_attributes(opts) ⇒ Object

:nodoc:



89
90
91
92
93
94
# File 'lib/schema_plus.rb', line 89

def update_attributes(opts)#:nodoc:
  opts = opts.dup
  opts.keys.each { |key| self.send(key).update_attributes(opts.delete(key)) if self.class.attributes.include? key and Hash === opts[key] }
  super(opts)
  self
end