Class: Associationist::Builder::CollectionAssociation
- Inherits:
-
ActiveRecord::Associations::Builder::CollectionAssociation
- Object
- ActiveRecord::Associations::Builder::CollectionAssociation
- Associationist::Builder::CollectionAssociation
- Defined in:
- lib/associationist/builder/collection_association.rb
Class Method Summary collapse
- .create_reflection(model, name, scope, options, extension = nil) ⇒ Object
- .macro ⇒ Object
- .valid_dependent_options ⇒ Object
- .valid_options(options) ⇒ Object
Class Method Details
.create_reflection(model, name, scope, options, extension = nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/associationist/builder/collection_association.rb', line 16 def self.create_reflection(model, name, scope, , extension = nil) raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol) () case when ActiveRecord.version >= Gem::Version.new('6.0.0') scope = build_scope(scope) else scope = build_scope(scope, extension) end Reflection::CollectionReflection.new(name, scope, , model) end |
.macro ⇒ Object
4 5 6 |
# File 'lib/associationist/builder/collection_association.rb', line 4 def self.macro :has_many end |
.valid_dependent_options ⇒ Object
12 13 14 |
# File 'lib/associationist/builder/collection_association.rb', line 12 def self. [:destroy, :delete_all, :nullify, :restrict_with_error, :restrict_with_exception] end |
.valid_options(options) ⇒ Object
8 9 10 |
# File 'lib/associationist/builder/collection_association.rb', line 8 def self.() super + [:associationist] end |