Module: ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods
- Defined in:
- lib/activerecord_spanner_adapter/primary_key.rb
Instance Method Summary collapse
- #fetch_primary_and_parent_key ⇒ Object
- #primary_and_parent_key ⇒ Object
- #primary_and_parent_key=(value) ⇒ Object
- #reset_primary_and_parent_key ⇒ Object
Instance Method Details
#fetch_primary_and_parent_key ⇒ Object
20 21 22 23 |
# File 'lib/activerecord_spanner_adapter/primary_key.rb', line 20 def fetch_primary_and_parent_key return connection.spanner_schema_cache.primary_and_parent_keys table_name \ if ActiveRecord::Base != self && table_exists? end |
#primary_and_parent_key ⇒ Object
11 12 13 14 |
# File 'lib/activerecord_spanner_adapter/primary_key.rb', line 11 def primary_and_parent_key reset_primary_and_parent_key unless defined? @primary_and_parent_key @primary_and_parent_key end |
#primary_and_parent_key=(value) ⇒ Object
25 26 27 |
# File 'lib/activerecord_spanner_adapter/primary_key.rb', line 25 def primary_and_parent_key= value @primary_and_parent_key = value end |
#reset_primary_and_parent_key ⇒ Object
16 17 18 |
# File 'lib/activerecord_spanner_adapter/primary_key.rb', line 16 def reset_primary_and_parent_key self.primary_and_parent_key = base_class? ? fetch_primary_and_parent_key : base_class.primary_and_parent_key end |