patriarch 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,14 @@
1
1
  require "redis/objects/sorted_sets"
2
2
 
3
+ # Patriarch::Transaction instances are composed of transaction steps that each represent
4
+ # a behaviour being triggered. RelationshipBuilderServices allow Services managing transaction
5
+ # flow to build transaction step correctly. This deals with transaction step needed to represent
6
+ # bipartite behaviours
3
7
  class Patriarch::DAOServices::BipartiteRelationshipBuilderService < Patriarch::Service
8
+
9
+ # @param [Patriarch::Transaction] transaction_item
10
+ # Fills current transaction step of the Patriarch::Transaction argument passed with data needed
11
+ # later to execute transaction. This deals with "DO" behaviour steps
4
12
  def create(transaction_item)
5
13
  t = Time.now.to_f
6
14
  dao_tab = Patriarch::DAOServices::RetrieverService.instance.call(transaction_item)
@@ -16,6 +24,9 @@ class Patriarch::DAOServices::BipartiteRelationshipBuilderService < Patriarch::S
16
24
  transaction_item.add_to_queue ll
17
25
  end
18
26
 
27
+ # @param [Patriarch::Transaction] transaction_item
28
+ # Fills current transaction step of the Patriarch::Transaction argument passed with data needed
29
+ # later to execute transaction. This deals with "UNDO" behaviour steps
19
30
  def destroy(transaction_item)
20
31
  dao_tab = Patriarch::DAOServices::RetrieverService.instance.call(transaction_item)
21
32
 
@@ -33,7 +44,10 @@ class Patriarch::DAOServices::BipartiteRelationshipBuilderService < Patriarch::S
33
44
  end
34
45
 
35
46
  protected
36
-
47
+ # @param [Redis::Objects] dao
48
+ # @param [Array] ids
49
+ # @param [Time] time
50
+ # Returns lambda objects that store a redis operation
37
51
  def build_lambda_for_create(dao,id,time)
38
52
  if dao.is_a? Redis::SortedSet
39
53
  return lambda { dao.add id, time }
@@ -1,22 +1,30 @@
1
+ # This service is in charge of the redis mapping.
2
+ # When wanting to retrieve DAOs needed for a transaction, we may want to retrieve Redis DAO
3
+ # For each situation e.g. (in a given transaction, with a given protagonist that has an unique role), the
4
+ # service will return the configuration needed to achieve DAO build. Hence it enforces conventions
1
5
  class Patriarch::DAOServices::RedisMapperService < Patriarch::Service
2
- def call(transac,protagonist_type)
3
-
6
+
7
+ # @param [Patriach::Transaction]transaction the transaction being processed
8
+ # @param [Symbol] protagonist_type the type of the protagonist whose DAO is needed
9
+ # @return [Hash] hash with configuration needed to achieve DAO build
10
+ def call(transaction,protagonist_type)
11
+
4
12
  # Getting symbols here ...
5
- relation_type = transac.relation_type
6
- actor_type = transac.actor_type
7
- target_type = transac.target_type
8
- medium_type = transac.medium_type
9
-
13
+ relation_type = transaction.relation_type
14
+ actor_type = transaction.actor_type
15
+ target_type = transaction.target_type
16
+ medium_type = transaction.medium_type
17
+
10
18
  relation_type_str = sanitize_relation_type(relation_type.to_s)
11
19
 
12
- if transac.tripartite?
20
+ if transaction.tripartite?
13
21
  if protagonist_type == :actor
14
22
  redis_tripartite_config_for_actor(target_type,medium_type,relation_type_str)
15
23
  elsif protagonist_type == :target
16
24
  redis_tripartite_config_for_target(actor_type,medium_type,relation_type_str)
17
25
  elsif protagonist_type == :medium
18
26
  redis_tripartite_config_for_medium(actor_type,target_type,relation_type_str)
19
- end
27
+ end
20
28
  else
21
29
  if protagonist_type == :actor
22
30
  redis_bipartite_config_for_actor(target_type,relation_type_str)
@@ -26,53 +34,74 @@ class Patriarch::DAOServices::RedisMapperService < Patriarch::Service
26
34
  end
27
35
  end
28
36
 
37
+ # @param [String] target_model_name
38
+ # @param [String] relation_type_str
39
+ # @return [Hash] a hash containing configuration to build actor DAO used in bipartite transactions
29
40
  def redis_bipartite_config_for_actor(target_model_name,relation_type_str)
30
- # example : items_i_like ...
31
- {
32
- :type => "sorted_set",
41
+ # example : items_i_like ...
42
+ {
43
+ :type => "sorted_set",
33
44
  :key => "patriarch_#{target_model_name.to_s.tableize}_i_#{relation_type_str}"
34
45
  }
35
46
  end
36
47
 
48
+ # @param [String] target_model_name
49
+ # @param [String] relation_type_str
50
+ # @return [Hash] a hash containing configuration to build target DAO used in bipartite transactions
37
51
  def redis_bipartite_config_for_target(actor_model_name,relation_type_str)
38
52
  # example : items_liking_me ...
39
- {
40
- :type => "sorted_set",
53
+ {
54
+ :type => "sorted_set",
41
55
  :key => "patriarch_#{actor_model_name.to_s.tableize}_#{progressive_present(relation_type_str)}_me"
42
56
  }
43
- end
57
+ end
44
58
 
59
+ # @param [String] target_model_name
60
+ # @param [String] relation_type_str
61
+ # @return [Hash] a hash containing configuration to build actor DAO used in tripartite transactions
45
62
  def redis_tripartite_config_for_actor(target_model_name,medium_model_name,relation_type_str)
46
- {
47
- :type => "sorted_set",
63
+ {
64
+ :type => "sorted_set",
48
65
  :key => "patriarch_#{target_model_name.to_s.tableize}_i_#{relation_type_str}_via_#{medium_model_name.to_s.tableize}",
49
66
  :options => { :marshal => true }
50
67
  }
51
68
  end
52
-
69
+
70
+ # @param [String] target_model_name
71
+ # @param [String] relation_type_str
72
+ # @return [Hash] a hash containing configuration to build medium DAO used in tripartite transactions
53
73
  def redis_tripartite_config_for_medium(actor_model_name,target_model_name,relation_type_str)
54
- {
55
- :type => "sorted_set",
74
+ {
75
+ :type => "sorted_set",
56
76
  :key => "patriarch_#{actor_model_name.to_s.tableize}_#{progressive_present(relation_type_str)}_#{target_model_name.to_s.tableize}_via_me",
57
- :options => { :marshal => true }
58
- }
77
+ :options => { :marshal => true }
78
+ }
59
79
  end
60
80
 
81
+ # @param [String] target_model_name
82
+ # @param [String] relation_type_str
83
+ # @return [Hash] a hash containing configuration to build target DAO used in tripartite transactions
61
84
  def redis_tripartite_config_for_target(actor_model_name,medium_model_name,relation_type_str)
62
85
  # example : items_praising_me_via_comments
63
- {
64
- :type => "sorted_set",
86
+ {
87
+ :type => "sorted_set",
65
88
  :key => "patriarch_#{actor_model_name.to_s.tableize}_#{progressive_present(relation_type_str)}_me_via_#{medium_model_name.to_s.tableize}",
66
- :options => { :marshal => true }
67
- }
89
+ :options => { :marshal => true }
90
+ }
68
91
  end
69
92
 
93
+ # Little helper to put behaviour verbs to progressive form, relies on gem 'Verbs'
94
+ # @param [String] behaviour_verb the verb to conjugate
95
+ # @return [String] progressive form of behaviour_verb
70
96
  def progressive_present(behaviour_verb)
71
97
  # like becomes => liking
72
98
  (Verbs::Conjugator.conjugate behaviour_verb.to_sym, :aspect => :progressive).split(/ /).last
73
99
  end
74
100
 
101
+ # Helper to sanitize relation type string that is equivalent to behaviour verb with a prefix to its base root.
102
+ # DAO and DB storage are agnostic about what kind of operation is being performed on them, hence we dont
103
+ # need to know if it will be an undo or a 'do'.
75
104
  def sanitize_relation_type(relation_type)
76
105
  relation_type.sub(/^undo_/,'')
77
106
  end
78
- end
107
+ end
@@ -3,37 +3,45 @@ require 'redis/objects/sorted_sets'
3
3
  class InvalidRedisTypeException < Exception
4
4
  end
5
5
 
6
+ # Services managing transactions must not know how the database layer is structured.
7
+ # We thus provide DAO through this RetrieverService and let them know about the interface of the DAOs
6
8
  class Patriarch::DAOServices::RetrieverService < Patriarch::Service
7
- # go hash
8
- def call(transaction_item)
9
+
10
+ # @return [Hash] hash containing DAOs for RelationshipBuilderServices to toy with
11
+ # @param [Patriarch::Transaction] transaction_item
12
+ # Only public method of this service, does the work of retrieving DAOs for a given transaction step
13
+ def call(transaction_item)
9
14
  result = {}
10
15
  result[:actor] = instantiate_DAO_for_actor(transaction_item)
11
16
  result[:target] = instantiate_DAO_for_target(transaction_item)
12
17
  if transaction_item.tripartite?
13
- result[:medium] = instantiate_DAO_for_medium(transaction_item)
18
+ result[:medium] = instantiate_DAO_for_medium(transaction_item)
14
19
  end
15
- result
20
+ result
16
21
  end
17
22
 
18
23
  protected
19
-
24
+ #:nodoc:
20
25
  def get_DAO_info_for_actor(transaction_item)
21
26
  Patriarch::DAOServices::RedisMapperService.instance.call(transaction_item,:actor)
22
27
  end
23
28
 
24
- def get_DAO_info_for_target(transaction_item)
29
+ #:nodoc
30
+ def get_DAO_info_for_target(transaction_item)
25
31
  Patriarch::DAOServices::RedisMapperService.instance.call(transaction_item,:target)
26
32
  end
27
-
33
+
34
+ #:nodoc
28
35
  def get_DAO_info_for_medium(transaction_item)
29
36
  Patriarch::DAOServices::RedisMapperService.instance.call(transaction_item,:medium)
30
37
  end
31
38
 
39
+ #:nodoc:
32
40
  def instantiate_DAO_for_actor(transaction_item)
33
- dao_info = get_DAO_info_for_actor(transaction_item)
41
+ dao_info = get_DAO_info_for_actor(transaction_item)
34
42
  actor_id = transaction_item.actor_id
35
43
  actor_type = transaction_item.actor_type
36
-
44
+
37
45
  if Redis::Objects.constants.map(&:to_s).include?("#{dao_info[:type].pluralize.camelize}")
38
46
  redis_dao_class = "Redis::#{dao_info[:type].camelize}".constantize
39
47
  else
@@ -42,12 +50,14 @@ class Patriarch::DAOServices::RetrieverService < Patriarch::Service
42
50
 
43
51
  redis_dao_class.new("#{actor_type}:#{actor_id}:#{dao_info[:key]}",dao_info[:options])
44
52
  end
45
-
53
+
54
+
55
+ #:nodoc:
46
56
  def instantiate_DAO_for_medium(transaction_item)
47
- dao_info = get_DAO_info_for_medium(transaction_item)
57
+ dao_info = get_DAO_info_for_medium(transaction_item)
48
58
  medium_id = transaction_item.medium_id
49
59
  medium_type = transaction_item.medium_type
50
-
60
+
51
61
  if Redis::Objects.constants.map(&:to_s).include?("#{dao_info[:type].pluralize.camelize}")
52
62
  redis_dao_class = "Redis::#{dao_info[:type].camelize}".constantize
53
63
  else
@@ -55,19 +65,21 @@ class Patriarch::DAOServices::RetrieverService < Patriarch::Service
55
65
  end
56
66
 
57
67
  redis_dao_class.new("#{medium_type}:#{medium_id}:#{dao_info[:key]}",dao_info[:options])
58
- end
68
+ end
69
+
59
70
 
71
+ #:nodoc:
60
72
  def instantiate_DAO_for_target(transaction_item)
61
73
  dao_info = get_DAO_info_for_target(transaction_item)
62
74
  target_id = transaction_item.target_id
63
- target_type = transaction_item.target_type
75
+ target_type = transaction_item.target_type
64
76
 
65
77
  if Redis::Objects.constants.map(&:to_s).include?("#{dao_info[:type].pluralize.camelize}")
66
78
  redis_dao_class = "Redis::#{dao_info[:type].camelize}".constantize
67
79
  else
68
80
  raise InvalidRedisTypeException, "Redis constants available were #{Redis::Objects.constants} and supplied type was #{dao_info[:type]}"
69
81
  end
70
- redis_dao_class.new("#{target_type}:#{target_id}:#{dao_info[:key]}",dao_info[:options])
82
+ redis_dao_class.new("#{target_type}:#{target_id}:#{dao_info[:key]}",dao_info[:options])
71
83
  end
72
84
  end
73
85
 
@@ -1,33 +1,45 @@
1
1
  require "redis/objects/sorted_sets"
2
2
 
3
+
4
+ # Patriarch::Transaction instances are composed of transaction steps that each represent
5
+ # a behaviour being triggered. RelationshipBuilderServices allow Services managing transaction
6
+ # flow to build transaction step correctly. This deals with transaction step needed to represent
7
+ # tripartite behaviours
3
8
  class Patriarch::DAOServices::TripartiteRelationshipBuilderService < Patriarch::Service
9
+
10
+ # @param [Patriarch::Transaction] transaction_item
11
+ # Fills current transaction step of the Patriarch::Transaction argument passed with data needed
12
+ # later to execute transaction. This deals with "DO" behaviour steps
4
13
  def create(transaction_item)
5
14
  t = Time.now.to_f
6
15
  dao_tab = Patriarch::DAOServices::RetrieverService.instance.call(transaction_item)
7
-
16
+
8
17
  actor_dao = dao_tab[:actor]
9
18
  target_dao = dao_tab[:target]
10
- medium_dao = dao_tab[:medium]
19
+ medium_dao = dao_tab[:medium]
11
20
 
12
21
  protagonist_ids = [transaction_item.actor_id,transaction_item.target_id,transaction_item.medium_id]
13
22
 
14
23
  l = build_lambda_for_create(actor_dao,protagonist_ids,t)
15
24
  ll = build_lambda_for_create(target_dao,protagonist_ids,t)
16
25
  lll = build_lambda_for_create(medium_dao,protagonist_ids,t)
17
-
26
+
18
27
  # care about that, should be encapsulated into a beautiful add_to_queue method
19
28
  transaction_item.add_to_queue l
20
29
  transaction_item.add_to_queue ll
21
- transaction_item.add_to_queue lll
30
+ transaction_item.add_to_queue lll
22
31
  end
23
32
 
33
+ # @param [Patriarch::Transaction] transaction_item
34
+ # Fills current transaction step of the Patriarch::Transaction argument passed with data needed
35
+ # later to execute transaction. This deals with "UNDO" behaviour steps
24
36
  def destroy(transaction_item)
25
37
  dao_tab = Patriarch::DAOServices::RetrieverService.instance.call(transaction_item)
26
-
38
+
27
39
  actor_dao = dao_tab[:actor]
28
40
  target_dao = dao_tab[:target]
29
- medium_dao = dao_tab[:medium]
30
-
41
+ medium_dao = dao_tab[:medium]
42
+
31
43
  protagonist_ids = [transaction_item.actor_id,transaction_item.target_id,transaction_item.medium_id]
32
44
 
33
45
  l = lambda { actor_dao.delete protagonist_ids }
@@ -36,11 +48,14 @@ class Patriarch::DAOServices::TripartiteRelationshipBuilderService < Patriarch::
36
48
 
37
49
  transaction_item.add_to_queue l
38
50
  transaction_item.add_to_queue ll
39
- transaction_item.add_to_queue lll
51
+ transaction_item.add_to_queue lll
40
52
  end
41
53
 
42
54
  protected
43
-
55
+ # @param [Redis::Objects] dao
56
+ # @param [Array] ids
57
+ # @param [Time] time
58
+ # Returns lambda objects that store a redis operation
44
59
  def build_lambda_for_create(dao,ids,time)
45
60
  if dao.is_a? Redis::SortedSet
46
61
  return lambda { dao.add ids, time }
@@ -1,6 +1,7 @@
1
1
  require 'singleton'
2
2
 
3
3
  module Patriarch
4
+ # Mother class of all Manager Services
4
5
  class ManagerService
5
6
  include Singleton
6
7
  end
@@ -1,5 +1,8 @@
1
1
  require 'singleton'
2
2
 
3
- class Patriarch::Service
4
- include Singleton
3
+ module Patriarch
4
+ # Mother class of all services
5
+ class Service
6
+ include Singleton
7
+ end
5
8
  end
@@ -1,6 +1,13 @@
1
+ # Adding behaviours to classes through Patriarch induces writes in Redis Database
2
+ # What happens when we want to destroy an item is that it fires ActiveRecord::Callbacks to deal
3
+ # with this kind of stuff. We build a transaction item whose execute would clean redis stuff
4
+ # but do nothing until commit happens in case SQL aborts.
5
+ # This service takes care of building clean items
1
6
  class Patriarch::ToolServices::RedisCleanerService < Patriarch::Service
2
-
3
- # Shall be tested before implementation ...
7
+
8
+ # @param [Object] calling_entity the entity calling the clean upon itself
9
+ # @param [Object] options various options we may want to pass, used here to transmit a transaction item if a clean transaction wraps all the clean
10
+ # @return [Patriarch::Transaction] returns a transaction item that is either built from scratch or was passed through options and has been completed
4
11
  def clean_all(calling_entity,options={})
5
12
  transac = options[:transac] || Patriarch::TransactionServices::TransactionManagerService.instance.new_transaction("clean_all".to_sym)
6
13
  options = { :transac => transac }
@@ -12,11 +19,17 @@ class Patriarch::ToolServices::RedisCleanerService < Patriarch::Service
12
19
  transac
13
20
  end
14
21
 
22
+ # @return [Patriarch::Transaction] returns a transaction item that is either built from scratch or was passed through options and has been completed
23
+ # @param [Object] calling_entity the entity calling the clean upon itself
24
+ # @param [Object] behaviour the behaviour the entity wants to clean
25
+ # @param [Object] options various options we may want to pass, used here to transmit a transaction item if a clean transaction wraps all the clean
26
+ # behaviours so it runs once and not multiple transactions.
15
27
  def clean_behaviour(calling_entity,behaviour,options={})
16
28
  my_behaviours = calling_entity.class.patriarch_behaviours
17
-
18
- if my_behaviours.include? behaviour.to_s.underscore.to_sym
19
- if my_behaviours[behaviour.to_s.underscore.to_sym][:medium_between] || my_behaviours[behaviour.to_s.underscore.to_sym][:via]
29
+ behaviour_symbol = behaviour.to_s.underscore.to_sym
30
+
31
+ if my_behaviours.include? behaviour_symbol
32
+ if my_behaviours[behaviour_symbol][:medium_between] || my_behaviours[behaviour_symbol][:via]
20
33
  clean_tripartite_behaviour(calling_entity,behaviour,options)
21
34
  else
22
35
  clean_bipartite_behaviour(calling_entity,behaviour,options)
@@ -24,24 +37,24 @@ class Patriarch::ToolServices::RedisCleanerService < Patriarch::Service
24
37
  end
25
38
  end
26
39
 
27
-
28
- #Copiepat
40
+ #:nodoc:
29
41
  def clean_tripartite_behaviour(calling_entity,behaviour,options={})
30
42
  my_behaviours = calling_entity.class.patriarch_behaviours
31
-
32
- # Compute names based on conventions
33
- progressive_present_behaviour =
34
- (Verbs::Conjugator.conjugate behaviour.to_s.underscore.to_sym, :aspect => :progressive).split(/ /).last
43
+ behaviour_symbol = behaviour.to_s.underscore.to_sym
44
+
45
+ # Compute names based on conventions
46
+ progressive_present_behaviour =
47
+ (Verbs::Conjugator.conjugate behaviour_symbol, :aspect => :progressive).split(/ /).last
35
48
 
36
49
  transac = options[:transac] || Patriarch::TransactionServices::TransactionManagerService.instance.new_transaction("clean_#{behaviour.to_s}".to_sym)
37
50
  options = { :transac => transac, :stop_execution => true}
38
51
 
39
- if my_behaviours.include? behaviour.to_s.underscore.to_sym
52
+ if my_behaviours.include? behaviour_symbol
40
53
 
41
54
  # Dealing with active behaviour
42
- if my_behaviours[behaviour.to_s.underscore.to_sym][:on]
43
- acted_on_models = my_behaviours[behaviour.to_s.underscore.to_sym][:on]
44
- via_models = my_behaviours[behaviour.to_s.underscore.to_sym][:via]
55
+ if my_behaviours[behaviour_symbol][:on]
56
+ acted_on_models = my_behaviours[behaviour_symbol][:on]
57
+ via_models = my_behaviours[behaviour_symbol][:via]
45
58
  acted_on_models.each do |acted_on_model|
46
59
  via_models.each do |via_model|
47
60
  calling_entity.send("#{acted_on_model.to_s.tableize}_i_#{behaviour.to_s}_via_#{via_model.to_s.tableize}", :with_medium => true).each do |tripartite_hash|
@@ -52,13 +65,13 @@ class Patriarch::ToolServices::RedisCleanerService < Patriarch::Service
52
65
  end
53
66
  end
54
67
  end
55
-
68
+
56
69
  # Dealing with passive behaviour
57
- if my_behaviours[behaviour.to_s.underscore.to_sym][:by]
58
- targetted_by_models = my_behaviours[behaviour.to_s.underscore.to_sym][:by]
59
- via_models = my_behaviours[behaviour.to_s.underscore.to_sym][:via]
70
+ if my_behaviours[behaviour_symbol][:by]
71
+ targetted_by_models = my_behaviours[behaviour_symbol][:by]
72
+ via_models = my_behaviours[behaviour_symbol][:via]
60
73
  targetted_by_models.each do |targetted_by_model|
61
- via_models.each do |via_model|
74
+ via_models.each do |via_model|
62
75
  calling_entity.send("#{targetted_by_model.to_s.tableize}_#{progressive_present_behaviour}_me_via_#{via_model.to_s.tableize}", :with_medium => true).each do |tripartite_hash|
63
76
  #
64
77
  actor_that_behaved_on_me = Array(targetted_by_model.to_s.classify.constantize.find(tripartite_hash[:actor])).first
@@ -71,46 +84,46 @@ class Patriarch::ToolServices::RedisCleanerService < Patriarch::Service
71
84
  end
72
85
 
73
86
  # Dealing with medium behaviour
74
- if my_behaviours[behaviour.to_s.underscore.to_sym][:medium_between]
87
+ if my_behaviours[behaviour_symbol][:medium_between]
75
88
  #do nothing, we do not take care of data relative to medium ...
76
- end
89
+ end
77
90
  end # if my_behaviours.include?
78
91
 
79
- transac
92
+ transac
80
93
  end #clean_tripartite_behaviour
81
94
 
82
-
83
-
95
+ #:nodoc:
84
96
  def clean_bipartite_behaviour(calling_entity,behaviour,options={})
85
97
  my_behaviours = calling_entity.class.patriarch_behaviours
86
-
87
- # Compute names based on conventions
88
- progressive_present_behaviour =
89
- (Verbs::Conjugator.conjugate behaviour.to_s.underscore.to_sym, :aspect => :progressive).split(/ /).last
98
+ behaviour_symbol = behaviour.to_s.underscore.to_sym
99
+
100
+ # Compute names based on conventions
101
+ progressive_present_behaviour =
102
+ (Verbs::Conjugator.conjugate behaviour_symbol, :aspect => :progressive).split(/ /).last
90
103
 
91
104
  transac = options[:transac] || Patriarch::TransactionServices::TransactionManagerService.instance.new_transaction("clean_#{behaviour.to_s}".to_sym)
92
105
  options = { :transac => transac, :stop_execution => true}
93
106
 
94
- if my_behaviours.include? behaviour.to_s.underscore.to_sym
107
+ if my_behaviours.include? behaviour_symbol
95
108
  # Dealing with passive behaviour
96
- if my_behaviours[behaviour.to_s.underscore.to_sym][:by]
97
- targetted_by_models = my_behaviours[behaviour.to_s.underscore.to_sym][:by]
98
- targetted_by_models.each do |targetted_by_model|
99
- calling_entity.send("#{targetted_by_model.to_s.tableize}_#{progressive_present_behaviour}_me").each do |target_that_behaved_on_me|
109
+ if my_behaviours[behaviour_symbol][:by]
110
+ targeted_by_models = my_behaviours[behaviour_symbol][:by]
111
+ targeted_by_models.each do |targeted_by_model|
112
+ calling_entity.send("#{targeted_by_model.to_s.tableize}_#{progressive_present_behaviour}_me").each do |target_that_behaved_on_me|
100
113
  target_that_behaved_on_me.send(Patriarch.undo(behaviour.to_s).underscore,calling_entity,options)
101
114
  end
102
115
  end
103
116
  end
104
117
  # Dealing with active behaviour
105
- if my_behaviours[behaviour.to_s.underscore.to_sym][:on]
106
- acted_on_models = my_behaviours[behaviour.to_s.underscore.to_sym][:on]
118
+ if my_behaviours[behaviour_symbol][:on]
119
+ acted_on_models = my_behaviours[behaviour_symbol][:on]
107
120
  acted_on_models.each do |acted_on_model|
108
121
  calling_entity.send("#{acted_on_model.to_s.tableize}_i_#{behaviour.to_s}").each do |target_i_behaved_on|
109
122
  calling_entity.send(Patriarch.undo(behaviour.to_s).underscore,target_i_behaved_on,options)
110
123
  end
111
124
  end
112
125
  end
113
-
126
+
114
127
 
115
128
  end # if my_behaviours.include?
116
129