Class: SmartCollection::Builder::SmartCollectionAssociation
- Inherits:
-
ActiveRecord::Associations::Builder::CollectionAssociation
- Object
- ActiveRecord::Associations::Builder::CollectionAssociation
- SmartCollection::Builder::SmartCollectionAssociation
- Defined in:
- lib/smart_collection/builder/smart_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 |
# File 'lib/smart_collection/builder/smart_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) () scope = build_scope(scope, extension) Reflection::SmartCollectionReflection.new(name, scope, , model) end |
.macro ⇒ Object
4 5 6 |
# File 'lib/smart_collection/builder/smart_collection_association.rb', line 4 def self.macro :has_many end |
.valid_dependent_options ⇒ Object
12 13 14 |
# File 'lib/smart_collection/builder/smart_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/smart_collection/builder/smart_collection_association.rb', line 8 def self.() super + [:primary_key, :dependent, :as, :through, :source, :source_type, :inverse_of, :counter_cache, :join_table, :foreign_type, :index_errors, :smart_collection] end |