Class: SimpleMaster::ActiveRecord::BelongsToPolymorphicBuilder

Inherits:
ActiveRecord::Associations::Builder::BelongsTo
  • Object
show all
Defined in:
lib/simple_master/active_record/belongs_to_polymorphic_builder.rb

Class Method Summary collapse

Class Method Details

.create_reflection(model, name, scope, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/simple_master/active_record/belongs_to_polymorphic_builder.rb', line 6

def self.create_reflection(model, name, scope, options, &)
  fail ArgumentError, "association names must be a Symbol" unless name.is_a?(Symbol)

  validate_options(options)

  extension = define_extensions(model, name, &)
  options[:extend] = [*options[:extend], extension] if extension

  scope = build_scope(scope)

  fail "not implemented" if options[:through]
  BelongsToMasterPolymorphicReflection.new(name, scope, options, model)
end