method
create_reflection
v7.1.3.2 -
Show latest stable
- Class:
ActiveRecord::Associations::Builder::Association
create_reflection(model, name, scope, options, &block)public
No documentation available.
# File activerecord/lib/active_record/associations/builder/association.rb, line 40
def self.create_reflection(model, name, scope, options, &block)
raise ArgumentError, "association names must be a Symbol" unless name.kind_of?(Symbol)
validate_options(options)
extension = define_extensions(model, name, &block)
options[:extend] = [*options[:extend], extension] if extension
scope = build_scope(scope)
ActiveRecord::Reflection.create(macro, name, scope, options, model)
end