-
Notifications
You must be signed in to change notification settings - Fork 463
/
Copy pathancestry.rb
37 lines (32 loc) · 1.27 KB
/
ancestry.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
require_relative 'ancestry/version'
require_relative 'ancestry/class_methods'
require_relative 'ancestry/instance_methods'
require_relative 'ancestry/exceptions'
require_relative 'ancestry/has_ancestry'
require_relative 'ancestry/materialized_path'
require_relative 'ancestry/materialized_path_pg'
I18n.load_path += Dir[File.join(File.expand_path(File.dirname(__FILE__)),
'ancestry', 'locales', '*.{rb,yml}').to_s]
module Ancestry
@@default_update_strategy = :ruby
# @!default_update_strategy
# @return [Symbol] the default strategy for updating ancestry
#
# 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
def self.default_update_strategy
@@default_update_strategy
end
def self.default_update_strategy=(value)
@@default_update_strategy = value
end
end