Class: ActiveRecord::ConnectionAdapters::Spanner::ReferenceDefinition
- Inherits:
-
ReferenceDefinition
- Object
- ReferenceDefinition
- ActiveRecord::ConnectionAdapters::Spanner::ReferenceDefinition
- Defined in:
- lib/active_record/connection_adapters/spanner/schema_definitions.rb
Instance Method Summary collapse
-
#initialize(name, polymorphic: false, index: true, foreign_key: false, type: :integer, **options) ⇒ ReferenceDefinition
constructor
A new instance of ReferenceDefinition.
Constructor Details
#initialize(name, polymorphic: false, index: true, foreign_key: false, type: :integer, **options) ⇒ ReferenceDefinition
Returns a new instance of ReferenceDefinition.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/active_record/connection_adapters/spanner/schema_definitions.rb', line 65 def initialize \ name, polymorphic: false, index: true, foreign_key: false, type: :integer, ** @name = name @polymorphic = polymorphic @foreign_key = foreign_key # Only add an index if there is no foreign key, as Cloud Spanner will automatically add a managed index when # a foreign key is added. @index = index unless foreign_key @type = type @options = return unless polymorphic && foreign_key raise ArgumentError, "Cannot add a foreign key to a polymorphic relation" end |