Module: Ancestry
- Defined in:
- lib/ancestry.rb,
lib/ancestry/version.rb,
lib/ancestry/exceptions.rb,
lib/ancestry/has_ancestry.rb,
lib/ancestry/class_methods.rb,
lib/ancestry/instance_methods.rb,
lib/ancestry/materialized_path.rb,
lib/ancestry/materialized_path2.rb,
lib/ancestry/materialized_path_pg.rb
Defined Under Namespace
Modules: ClassMethods, HasAncestry, InstanceMethods, MaterializedPath, MaterializedPath2, MaterializedPathPg Classes: AncestryException, AncestryIntegrityException
Constant Summary collapse
- VERSION =
'5.0.0'- @@default_update_strategy =
:ruby- @@default_ancestry_format =
:materialized_path- @@default_primary_key_format =
'[0-9]+'
Class Method Summary collapse
-
.default_ancestry_format ⇒ Object
The value changes the default way that ancestry is stored in the database.
- .default_ancestry_format=(value) ⇒ Object
-
.default_primary_key_format ⇒ Object
The value represents the way the id looks for validation.
- .default_primary_key_format=(value) ⇒ Object
-
.default_update_strategy ⇒ Object
The value changes the default way that ancestry is updated for associated records.
- .default_update_strategy=(value) ⇒ Object
Class Method Details
.default_ancestry_format ⇒ Object
The value changes the default way that ancestry is stored in the database
:materialized_path (default and legacy)
Ancestry is of the form null (for no ancestors) and 1/2/ for children
:materialized_path2 (preferred)
Ancestry is of the form '/' (for no ancestors) and '/1/2/' for children
54 55 56 |
# File 'lib/ancestry.rb', line 54 def self.default_ancestry_format @@default_ancestry_format end |
.default_ancestry_format=(value) ⇒ Object
58 59 60 |
# File 'lib/ancestry.rb', line 58 def self.default_ancestry_format=(value) @@default_ancestry_format = value end |
.default_primary_key_format ⇒ Object
The value represents the way the id looks for validation
'[0-9]+' (default) for integer ids
'[-A-Fa-f0-9]{36}' for uuids (though you can find other regular expressions)
69 70 71 |
# File 'lib/ancestry.rb', line 69 def self.default_primary_key_format @@default_primary_key_format end |
.default_primary_key_format=(value) ⇒ Object
73 74 75 |
# File 'lib/ancestry.rb', line 73 def self.default_primary_key_format=(value) @@default_primary_key_format = value end |
.default_update_strategy ⇒ Object
The value changes the default way that ancestry is updated for associated records
:ruby (default and legacy value)
Child records will be loaded into memory and updated. callbacks will get called
The callbacks of interest are those that cache values based upon the ancestry value
:sql (currently only valid in postgres)
Child records are updated in sql and callbacks will not get called.
Associated records in memory will have the wrong ancestry value
34 35 36 |
# File 'lib/ancestry.rb', line 34 def self.default_update_strategy @@default_update_strategy end |
.default_update_strategy=(value) ⇒ Object
38 39 40 |
# File 'lib/ancestry.rb', line 38 def self.default_update_strategy=(value) @@default_update_strategy = value end |