Module: SchemaAssociations
- Defined in:
- lib/schema_associations.rb,
lib/schema_associations/railtie.rb,
lib/schema_associations/version.rb,
lib/schema_associations/active_record/associations.rb
Defined Under Namespace
Modules: ActiveRecord Classes: Config, Railtie
Constant Summary collapse
- VERSION =
"1.1.0"
Class Method Summary collapse
-
.config ⇒ Object
Returns the global configuration, i.e., the singleton instance of Config.
-
.insert ⇒ Object
:nodoc:.
-
.setup {|config| ... } ⇒ Object
Initialization block is passed a global Config instance that can be used to configure SchemaAssociations behavior.
Class Method Details
.config ⇒ Object
Returns the global configuration, i.e., the singleton instance of Config
94 95 96 |
# File 'lib/schema_associations.rb', line 94 def self.config @config ||= Config.new end |
.insert ⇒ Object
:nodoc:
111 112 113 114 115 |
# File 'lib/schema_associations.rb', line 111 def self.insert #:nodoc: return if @inserted @inserted = true ::ActiveRecord::Base.extend SchemaAssociations::ActiveRecord::Associations end |
.setup {|config| ... } ⇒ Object
Initialization block is passed a global Config instance that can be used to configure SchemaAssociations behavior. E.g., if you want to disable automation creation associations put the following in config/initializers/schema_associations.rb :
SchemaAssociations.setup do |config|
config.auto_create = false
end
107 108 109 |
# File 'lib/schema_associations.rb', line 107 def self.setup # :yields: config yield config end |