Module: ActiveType::RecordExtension::Inheritance
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/active_type/record_extension/inheritance.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Class Method Details
.add_foreign_key_option(extended_record_base_class, scope = nil, options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/active_type/record_extension/inheritance.rb', line 13 def self.add_foreign_key_option(extended_record_base_class, scope = nil, = {}) if scope.is_a?(Hash) = scope scope = nil end unless [:foreign_key] || [:as] = .merge(foreign_key: extended_record_base_class.name.foreign_key) end if ActiveRecord::VERSION::MAJOR > 3 [, scope] else [] end end |