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:



87
88
89
# File 'lib/schema_plus.rb', line 87

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:



98
99
100
# File 'lib/schema_plus.rb', line 98

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

#update_attributes(opts) ⇒ Object

:nodoc:



91
92
93
94
95
96
# File 'lib/schema_plus.rb', line 91

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