module ActiveType::RecordExtension::Inheritance
Public Class Methods
add_foreign_key_option(extended_record_base_class, scope = nil, options = {})
click to toggle source
# File lib/active_type/record_extension/inheritance.rb, line 13 def self.add_foreign_key_option(extended_record_base_class, scope = nil, options = {}) if scope.is_a?(Hash) options = scope scope = nil end unless options[:foreign_key] || options[:as] options = options.merge(foreign_key: extended_record_base_class.name.foreign_key) end if ActiveRecord::VERSION::MAJOR > 3 [options, scope] else [options] end end