og 0.24.0 → 0.25.0

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.
Files changed (51) hide show
  1. data/ProjectInfo +2 -5
  2. data/README +2 -0
  3. data/doc/AUTHORS +4 -1
  4. data/doc/RELEASES +53 -0
  5. data/examples/run.rb +2 -2
  6. data/lib/{og/mixin → glue}/hierarchical.rb +19 -19
  7. data/lib/{og/mixin → glue}/optimistic_locking.rb +1 -1
  8. data/lib/glue/orderable.rb +235 -0
  9. data/lib/glue/revisable.rb +2 -0
  10. data/lib/glue/taggable.rb +176 -0
  11. data/lib/{og/mixin/taggable.rb → glue/taggable_old.rb} +6 -0
  12. data/lib/glue/timestamped.rb +37 -0
  13. data/lib/{og/mixin → glue}/tree.rb +3 -8
  14. data/lib/og.rb +21 -20
  15. data/lib/og/collection.rb +15 -1
  16. data/lib/og/entity.rb +256 -114
  17. data/lib/og/manager.rb +60 -27
  18. data/lib/og/{mixin/schema_inheritance_base.rb → markers.rb} +5 -2
  19. data/lib/og/relation.rb +70 -74
  20. data/lib/og/relation/belongs_to.rb +5 -3
  21. data/lib/og/relation/has_many.rb +1 -0
  22. data/lib/og/relation/joins_many.rb +5 -4
  23. data/lib/og/store.rb +25 -46
  24. data/lib/og/store/alpha/filesys.rb +1 -1
  25. data/lib/og/store/alpha/kirby.rb +30 -30
  26. data/lib/og/store/alpha/memory.rb +49 -49
  27. data/lib/og/store/alpha/sqlserver.rb +7 -7
  28. data/lib/og/store/kirby.rb +38 -38
  29. data/lib/og/store/mysql.rb +43 -43
  30. data/lib/og/store/psql.rb +222 -53
  31. data/lib/og/store/sql.rb +165 -105
  32. data/lib/og/store/sqlite.rb +29 -25
  33. data/lib/og/validation.rb +24 -14
  34. data/lib/{vendor → og/vendor}/README +0 -0
  35. data/lib/{vendor → og/vendor}/kbserver.rb +1 -1
  36. data/lib/{vendor → og/vendor}/kirbybase.rb +230 -79
  37. data/lib/{vendor → og/vendor}/mysql.rb +0 -0
  38. data/lib/{vendor → og/vendor}/mysql411.rb +0 -0
  39. data/test/og/mixin/tc_hierarchical.rb +1 -1
  40. data/test/og/mixin/tc_optimistic_locking.rb +1 -1
  41. data/test/og/mixin/tc_orderable.rb +1 -1
  42. data/test/og/mixin/tc_taggable.rb +2 -2
  43. data/test/og/mixin/tc_timestamped.rb +2 -2
  44. data/test/og/tc_finder.rb +33 -0
  45. data/test/og/tc_inheritance.rb +2 -2
  46. data/test/og/tc_scoped.rb +45 -0
  47. data/test/og/tc_store.rb +1 -7
  48. metadata +21 -18
  49. data/lib/og/mixin/orderable.rb +0 -174
  50. data/lib/og/mixin/revisable.rb +0 -0
  51. data/lib/og/mixin/timestamped.rb +0 -24
@@ -6,12 +6,14 @@ class BelongsTo < RefersTo
6
6
 
7
7
  def enchant
8
8
  super
9
- unless target_class.ann.this[:descendants]
10
- target_class.ann(:this, :descendants => [])
9
+ unless target_class.ann.self[:descendants]
10
+ target_class.ann(:self, :descendants => [])
11
11
  end
12
- target_class.ann.this.descendants! << [owner_class, foreign_key]
12
+ target_class.ann.self.descendants! << [owner_class, foreign_key]
13
13
  end
14
14
 
15
15
  end
16
16
 
17
17
  end
18
+
19
+ # * George Moschovitis <gm@navel.gr>
@@ -40,6 +40,7 @@ class HasMany < Relation
40
40
  unless @#{target_plural_name}
41
41
  @#{target_plural_name} = HasManyCollection.new(
42
42
  self,
43
+ #{target_class},
43
44
  :add_#{target_singular_name},
44
45
  :remove_#{target_singular_name},
45
46
  :find_#{target_plural_name},
@@ -28,7 +28,7 @@ class JoinsMany < Relation
28
28
  # handle schema_inheritance
29
29
 
30
30
  join_class = owner_class
31
- if sclass = owner_class.ann.this[:superclass]
31
+ if sclass = owner_class.ann.self[:superclass]
32
32
  join_class = sclass
33
33
  end
34
34
  join_table_info = store.join_table_info(join_class, target_class)
@@ -42,8 +42,8 @@ class JoinsMany < Relation
42
42
  # Calculate the name of the join table
43
43
  join_table = self[:join_table] = join_table_info[:table]
44
44
  # Create a join table.
45
- owner_class.ann :this, :join_tables => []
46
- owner_class.ann.this.join_tables! << join_table_info
45
+ owner_class.ann :self, :join_tables => [] if owner_class.ann.self.join_tables.nil?
46
+ owner_class.ann.self.join_tables! << join_table_info
47
47
  end
48
48
 
49
49
  owner_key = join_table_info[:owner_key]
@@ -58,6 +58,7 @@ class JoinsMany < Relation
58
58
  unless @#{target_plural_name}
59
59
  @#{target_plural_name} = JoinsManyCollection.new(
60
60
  self,
61
+ #{target_class},
61
62
  :add_#{target_singular_name},
62
63
  :remove_#{target_singular_name},
63
64
  :find_#{target_plural_name},
@@ -72,7 +73,7 @@ class JoinsMany < Relation
72
73
  end
73
74
 
74
75
  def add_#{target_singular_name}(obj, options = nil)
75
- obj.save
76
+ obj.save if obj.unsaved?
76
77
  obj.class.ogmanager.store.join(self, obj, "#{join_table}", options)
77
78
  end
78
79
 
@@ -3,13 +3,13 @@ module Og
3
3
  # A Store is responsible for the peristance of the ObjectGraph.
4
4
 
5
5
  class Store
6
-
6
+
7
7
  # Options.
8
-
8
+
9
9
  attr_accessor :options
10
-
10
+
11
11
  # Transaction nesting.
12
-
12
+
13
13
  attr_accessor :transaction_nesting
14
14
 
15
15
  # :section: Store methods.
@@ -18,12 +18,12 @@ class Store
18
18
 
19
19
  def self.for_name(name)
20
20
  # gmosx: to keep RDoc happy.
21
- eval %{
21
+ eval %{
22
22
  require 'og/store/#{name}'
23
23
  return #{name.to_s.capitalize}Store
24
24
  }
25
25
  end
26
-
26
+
27
27
  # Creates a store.
28
28
 
29
29
  def self.create(options)
@@ -44,11 +44,11 @@ class Store
44
44
  end
45
45
 
46
46
  # Close the session to the store.
47
-
47
+
48
48
  def close
49
49
  end
50
50
 
51
- # Enchants a class.
51
+ # Enchants a class.
52
52
 
53
53
  def enchant(klass, manager)
54
54
  klass.class.send(:define_method, :index) do |arg|
@@ -67,36 +67,15 @@ class Store
67
67
  end
68
68
 
69
69
  # Evaluate an alias for the primary key.
70
-
70
+
71
71
  alias_method :pk, :#{pk}
72
72
  alias_method :pk=, :#{pk}=
73
-
73
+
74
74
  def self.pk_symbol
75
75
  :#{klass.primary_key.symbol}
76
76
  end
77
77
  }
78
78
 
79
- # Generate finder methods.
80
-
81
- code = ''
82
-
83
- for p in klass.properties.values
84
- # gmosx: :uniq does NOT set a unique constraint in the
85
- # database.
86
- finder = p.uniq || p.unique ? 'find_one' : 'find'
87
-
88
- code << %{
89
- def self.find_by_#{p}(val, operator = '=', options = {})
90
- options.update(
91
- :class => #{klass},
92
- :condition => "#{p.field || p}\#{operator}\#{ogmanager.store.quote(val)}"
93
- )
94
- ogmanager.store.#{finder}(options)
95
- end;
96
- }
97
- end
98
-
99
- klass.module_eval(code)
100
79
  end
101
80
 
102
81
  # :section: Lifecycle methods.
@@ -113,7 +92,7 @@ class Store
113
92
 
114
93
  # Save an object to store. Insert if this is a new object or
115
94
  # update if this is already inserted in the database.
116
-
95
+
117
96
  def save(obj, options = nil)
118
97
  if obj.saved?
119
98
  obj.og_update(self, options)
@@ -137,14 +116,14 @@ class Store
137
116
 
138
117
  # Update selected properties of an object or class of
139
118
  # objects.
140
-
119
+
141
120
  def update_properties(obj_or_class, props, options = nil)
142
121
  end
143
122
  alias_method :pupdate, :update_properties
144
123
  alias_method :update_property, :update_properties
145
-
124
+
146
125
  # Permanently delete an object from the store.
147
-
126
+
148
127
  def delete(obj_or_pk, klass = nil, cascade = true)
149
128
  unless obj_or_pk.is_a?(EntityMixin)
150
129
  # create a dummy instance to keep the og_delete
@@ -157,35 +136,35 @@ class Store
157
136
  end
158
137
 
159
138
  # Perform a query.
160
-
139
+
161
140
  def find(klass, options)
162
141
  end
163
142
 
164
143
  # Count the results returned by the query.
165
-
144
+
166
145
  def count(options)
167
146
  end
168
-
147
+
169
148
  # :section: Transaction methods.
170
-
149
+
171
150
  # Start a new transaction.
172
-
151
+
173
152
  def start
174
153
  raise 'Not implemented'
175
154
  true if @transaction_nesting < 1
176
155
  @transaction_nesting += 1
177
156
  end
178
-
157
+
179
158
  # Commit a transaction.
180
-
159
+
181
160
  def commit
182
161
  raise 'Not implemented'
183
162
  @transaction_nesting -= 1
184
163
  true if @transaction_nesting < 1
185
164
  end
186
-
165
+
187
166
  # Rollback a transaction.
188
-
167
+
189
168
  def rollback
190
169
  @transaction_nesting -= 1
191
170
  true if @transaction_nesting < 1
@@ -193,7 +172,7 @@ class Store
193
172
 
194
173
  # Transaction helper. In the transaction block use
195
174
  # the db pointer to the backend.
196
-
175
+
197
176
  def transaction(&block)
198
177
  begin
199
178
  start
@@ -220,7 +199,7 @@ private
220
199
 
221
200
  def eval_og_delete(klass)
222
201
  end
223
-
202
+
224
203
  def eval_og_create_schema(klass)
225
204
  end
226
205
  end
@@ -42,7 +42,7 @@ class FilesysStore < Store
42
42
  self.class.create(options)
43
43
  end
44
44
  end
45
-
45
+
46
46
  def enchant(klass, manager)
47
47
  super
48
48
 
@@ -44,7 +44,7 @@ class KirbyStore < SqlStore
44
44
  def close
45
45
  super
46
46
  end
47
-
47
+
48
48
  def enchant(klass, manager)
49
49
  klass.property :oid, Fixnum, :sql => 'integer PRIMARY KEY'
50
50
  super
@@ -67,11 +67,11 @@ class KirbyStore < SqlStore
67
67
  def start
68
68
  # nop
69
69
  end
70
-
70
+
71
71
  def commit
72
72
  # nop
73
73
  end
74
-
74
+
75
75
  def rollback
76
76
  # nop
77
77
  end
@@ -85,7 +85,7 @@ private
85
85
 
86
86
  # Create join tables if needed. Join tables are used in
87
87
  # 'many_to_many' relations.
88
-
88
+
89
89
  if klass.__meta and join_tables = klass.__meta[:join_tables]
90
90
  for join_table in join_tables
91
91
  begin
@@ -113,15 +113,15 @@ private
113
113
 
114
114
  def fields_for_class(klass)
115
115
  fields = []
116
-
116
+
117
117
  klass.properties.each do |p|
118
118
  klass.index(p.symbol) if p.meta[:index]
119
-
119
+
120
120
  fields << p.symbol
121
-
121
+
122
122
  type = p.klass.name.intern
123
123
  type = :Integer if type == :Fixnum
124
-
124
+
125
125
  fields << type
126
126
  end
127
127
 
@@ -135,7 +135,7 @@ private
135
135
  fields.size.times do |i|
136
136
  map[fields[i]] = i
137
137
  end
138
-
138
+
139
139
  return map
140
140
  end
141
141
 
@@ -160,15 +160,15 @@ private
160
160
  return %|@#{p.symbol} ? "'#\{#{self.class}.date(@#{p.symbol})\}'" : nil|
161
161
  elsif p.klass.ancestors.include?(TrueClass)
162
162
  return "@#{p.symbol} ? \"'t'\" : nil"
163
- else
163
+ else
164
164
  # gmosx: keep the '' for nil symbols.
165
165
  return %|@#{p.symbol} ? "'#\{#{self.class}.escape(@#{p.symbol}.to_yaml)\}'" : "''"|
166
166
  end
167
- end
167
+ end
168
168
 
169
169
  # Return an evaluator for reading the property.
170
170
  # No need to optimize this, used only to precalculate code.
171
-
171
+
172
172
  def read_prop(p, col)
173
173
  if p.klass.ancestors.include?(Integer)
174
174
  return "#{self.class}.parse_int(res[#{col} + offset])"
@@ -182,27 +182,27 @@ private
182
182
  return "#{self.class}.parse_date(res[#{col} + offset])"
183
183
  elsif p.klass.ancestors.include?(TrueClass)
184
184
  return "('0' != res[#{col} + offset])"
185
- else
185
+ else
186
186
  return "YAML::load(res[#{col} + offset])"
187
- end
187
+ end
188
188
  end
189
189
 
190
190
  # :section: Lifecycle method compilers.
191
-
191
+
192
192
  # Compile the og_update method for the class.
193
193
 
194
194
  def eval_og_insert(klass)
195
195
  pk = klass.pk_symbol
196
196
  props = klass.properties
197
-
197
+
198
198
  data = props.collect {|p| ":#{p.symbol} => #{write_prop(p)}"}.join(', ')
199
199
  # data.gsub!(/#|\{|\}/, '')
200
200
 
201
201
  klass.module_eval %{
202
202
  def og_insert(store)
203
- #{Aspects.gen_advice_code(:og_insert, klass.advices, :pre) if klass.respond_to?(:advices)}
203
+ #{Glue::Aspects.gen_advice_code(:og_insert, klass.advices, :pre) if klass.respond_to?(:advices)}
204
204
  store.conn.get_table('#{klass.table}').insert(#{data})
205
- #{Aspects.gen_advice_code(:og_insert, klass.advices, :post) if klass.respond_to?(:advices)}
205
+ #{Glue::Aspects.gen_advice_code(:og_insert, klass.advices, :post) if klass.respond_to?(:advices)}
206
206
  end
207
207
  }
208
208
  end
@@ -212,7 +212,7 @@ private
212
212
  def eval_og_update(klass)
213
213
  pk = klass.pk_symbol
214
214
  props = klass.properties.reject { |p| pk == p.symbol }
215
-
215
+
216
216
  updates = props.collect { |p|
217
217
  "#{p.symbol}=#{write_prop(p)}"
218
218
  }
@@ -221,9 +221,9 @@ private
221
221
 
222
222
  klass.module_eval %{
223
223
  def og_update(store)
224
- #{Aspects.gen_advice_code(:og_update, klass.advices, :pre) if klass.respond_to?(:advices)}
224
+ #{Glue::Aspects.gen_advice_code(:og_update, klass.advices, :pre) if klass.respond_to?(:advices)}
225
225
  store.exec "#{sql}"
226
- #{Aspects.gen_advice_code(:og_update, klass.advices, :post) if klass.respond_to?(:advices)}
226
+ #{Glue::Aspects.gen_advice_code(:og_update, klass.advices, :post) if klass.respond_to?(:advices)}
227
227
  end
228
228
  }
229
229
  end
@@ -232,7 +232,7 @@ private
232
232
  # used to read (deserialize) the given class from the store.
233
233
  # In order to allow for changing field/attribute orders a
234
234
  # field mapping hash is used.
235
-
235
+
236
236
  def eval_og_read(klass)
237
237
  code = []
238
238
  props = klass.properties
@@ -243,26 +243,26 @@ private
243
243
  code << "@#{p.symbol} = #{read_prop(p, col)}"
244
244
  end
245
245
  end
246
-
246
+
247
247
  code = code.join('; ')
248
248
 
249
249
  klass.module_eval %{
250
250
  def og_read(res, row = 0, offset = 0)
251
- #{Aspects.gen_advice_code(:og_read, klass.advices, :pre) if klass.respond_to?(:advices)}
251
+ #{Glue::Aspects.gen_advice_code(:og_read, klass.advices, :pre) if klass.respond_to?(:advices)}
252
252
  #{code}
253
- #{Aspects.gen_advice_code(:og_read, klass.advices, :post) if klass.respond_to?(:advices)}
253
+ #{Glue::Aspects.gen_advice_code(:og_read, klass.advices, :post) if klass.respond_to?(:advices)}
254
254
  end
255
255
  }
256
- end
256
+ end
257
257
 
258
258
  #--
259
259
  # FIXME: is pk needed as parameter?
260
260
  #++
261
-
261
+
262
262
  def eval_og_delete(klass)
263
263
  klass.module_eval %{
264
264
  def og_delete(store, pk, cascade = true)
265
- #{Aspects.gen_advice_code(:og_delete, klass.advices, :pre) if klass.respond_to?(:advices)}
265
+ #{Glue::Aspects.gen_advice_code(:og_delete, klass.advices, :pre) if klass.respond_to?(:advices)}
266
266
  pk ||= @#{klass.pk_symbol}
267
267
  transaction do |tx|
268
268
  tx.exec "DELETE FROM #{klass.table} WHERE #{klass.pk_symbol}=\#{pk}"
@@ -272,9 +272,9 @@ private
272
272
  end
273
273
  end
274
274
  end
275
- #{Aspects.gen_advice_code(:og_delete, klass.advices, :post) if klass.respond_to?(:advices)}
275
+ #{Glue::Aspects.gen_advice_code(:og_delete, klass.advices, :post) if klass.respond_to?(:advices)}
276
276
  end
277
- }
277
+ }
278
278
  end
279
279
 
280
280
  end
@@ -11,7 +11,7 @@ module Og
11
11
  module MemoryUtils
12
12
 
13
13
  # FIXME: find a neutral name.
14
-
14
+
15
15
  def table(klass)
16
16
  klass.to_s
17
17
  end
@@ -36,19 +36,19 @@ end
36
36
 
37
37
  class MemoryStore < Store
38
38
  extend MemoryUtils; include MemoryUtils
39
-
39
+
40
40
  class ObjectHash < Hash
41
41
  def [](key)
42
42
  super(key.to_s)
43
43
  end
44
-
44
+
45
45
  def []=(key, value)
46
46
  super(key.to_s, value)
47
47
  end
48
48
  end
49
-
49
+
50
50
  # This hash implements an in-memory database.
51
-
51
+
52
52
  @objects = ObjectHash.new
53
53
 
54
54
  def self.objects
@@ -58,9 +58,9 @@ class MemoryStore < Store
58
58
  def self.objects=(val)
59
59
  @objects = val
60
60
  end
61
-
61
+
62
62
  # A pseudo-connection to the actual object store.
63
-
63
+
64
64
  attr_accessor :conn
65
65
 
66
66
  def self.destroy(options)
@@ -68,7 +68,7 @@ class MemoryStore < Store
68
68
  rescue
69
69
  Logger.info "Cannot destroy '#{name}'"
70
70
  end
71
-
71
+
72
72
  def initialize(options)
73
73
  super
74
74
  begin
@@ -88,9 +88,9 @@ class MemoryStore < Store
88
88
  klass.property :oid, Fixnum
89
89
 
90
90
  super
91
-
91
+
92
92
  @conn[klass] ||= {}
93
-
93
+
94
94
  eval_og_insert(klass)
95
95
  eval_og_update(klass)
96
96
  eval_og_read(klass)
@@ -107,7 +107,7 @@ class MemoryStore < Store
107
107
 
108
108
  # Update selected properties of an object or class of
109
109
  # objects.
110
-
110
+
111
111
  def update_properties(target, set, options = nil)
112
112
  set = set.gsub(/,/, ';')
113
113
  if target.is_a?(Class)
@@ -125,7 +125,7 @@ class MemoryStore < Store
125
125
  end
126
126
  else
127
127
  target.instance_eval(set)
128
- end
128
+ end
129
129
  end
130
130
  alias_method :pupdate, :update_properties
131
131
  alias_method :update_property, :update_properties
@@ -137,13 +137,13 @@ class MemoryStore < Store
137
137
  # User.find(:condition => 'age > 15', :order => 'score ASC', :offet => 10, :limit =>10)
138
138
  # Comment.find(:include => :entry)
139
139
  # store.find(:class => User, :where => 'age > 15')
140
-
141
- def find(options)
140
+
141
+ def find(options)
142
142
  query(options)
143
143
  end
144
144
 
145
145
  # Find one object.
146
-
146
+
147
147
  def find_one(options)
148
148
  query(options).first
149
149
  end
@@ -155,48 +155,48 @@ class MemoryStore < Store
155
155
  end
156
156
 
157
157
  # Count results.
158
-
158
+
159
159
  def count(options)
160
160
  objects = 0
161
-
161
+
162
162
  if condition = options[:condition] || options[:where]
163
163
  condition = "obj." + condition.gsub(/=/, '==')
164
164
  else
165
165
  condition = true
166
166
  end
167
-
167
+
168
168
  eval %{
169
169
  for obj in @conn[options[:class]].values
170
170
  objects += 1 if #{condition}
171
171
  end
172
- }
173
-
172
+ }
173
+
174
174
  return objects
175
175
  end
176
176
 
177
177
  # Relate two objects through an intermediate join table.
178
178
  # Typically used in joins_many and many_to_many relations.
179
-
179
+
180
180
  def join(obj1, obj2, table)
181
181
  # nop
182
- end
183
-
182
+ end
183
+
184
184
  # Query.
185
-
185
+
186
186
  def query(options)
187
187
  objects = []
188
-
188
+
189
189
  if condition = options[:condition] || options[:where]
190
190
  condition = "obj." + condition.gsub(/=/, '==')
191
191
  else
192
192
  condition = true
193
193
  end
194
-
194
+
195
195
  eval %{
196
196
  for obj in @conn[options[:class]].values
197
197
  objects << obj if #{condition}
198
198
  end
199
- }
199
+ }
200
200
 
201
201
  if order = options[:order]
202
202
  desc = (order =~ /DESC/)
@@ -204,31 +204,31 @@ class MemoryStore < Store
204
204
  eval "objects.sort { |x, y| x.#{order} <=> y.#{order} }"
205
205
  objects.reverse! if desc
206
206
  end
207
-
208
- return objects
207
+
208
+ return objects
209
209
  end
210
-
210
+
211
211
  # :section: Transaction methods.
212
-
212
+
213
213
  # Start a new transaction.
214
-
214
+
215
215
  def start
216
216
  end
217
-
217
+
218
218
  # Commit a transaction.
219
-
219
+
220
220
  def commit
221
221
  end
222
-
222
+
223
223
  # Rollback a transaction.
224
-
224
+
225
225
  def rollback
226
226
  end
227
227
 
228
228
  private
229
229
 
230
230
  # :section: Lifecycle method compilers.
231
-
231
+
232
232
  # Compile the og_update method for the class.
233
233
 
234
234
  def eval_og_insert(klass)
@@ -236,10 +236,10 @@ private
236
236
 
237
237
  klass.class_eval %{
238
238
  def og_insert(store)
239
- #{Aspects.gen_advice_code(:og_insert, klass.advices, :pre) if klass.respond_to?(:advices)}
239
+ #{Glue::Aspects.gen_advice_code(:og_insert, klass.advices, :pre) if klass.respond_to?(:advices)}
240
240
  @#{pk} = store.conn[#{klass}].size + 1
241
241
  store.conn[#{klass}][@#{pk}] = self
242
- #{Aspects.gen_advice_code(:og_insert, klass.advices, :post) if klass.respond_to?(:advices)}
242
+ #{Glue::Aspects.gen_advice_code(:og_insert, klass.advices, :post) if klass.respond_to?(:advices)}
243
243
  end
244
244
  }
245
245
  end
@@ -251,29 +251,29 @@ private
251
251
 
252
252
  klass.class_eval %{
253
253
  def og_update(store, options)
254
- #{Aspects.gen_advice_code(:og_update, klass.advices, :pre) if klass.respond_to?(:advices)}
254
+ #{Glue::Aspects.gen_advice_code(:og_update, klass.advices, :pre) if klass.respond_to?(:advices)}
255
255
  store.conn[#{klass}][@#{pk}] = self
256
- #{Aspects.gen_advice_code(:og_update, klass.advices, :post) if klass.respond_to?(:advices)}
256
+ #{Glue::Aspects.gen_advice_code(:og_update, klass.advices, :post) if klass.respond_to?(:advices)}
257
257
  end
258
258
  }
259
259
  end
260
260
 
261
261
  # Not really useful in this store, kept for compatibility,
262
262
  # just to call the aspects.
263
-
263
+
264
264
  def eval_og_read(klass)
265
265
  klass.class_eval %{
266
266
  def og_read
267
- #{Aspects.gen_advice_code(:og_read, klass.advices, :pre) if klass.respond_to?(:advices)}
268
- #{Aspects.gen_advice_code(:og_read, klass.advices, :post) if klass.respond_to?(:advices)}
267
+ #{Glue::Aspects.gen_advice_code(:og_read, klass.advices, :pre) if klass.respond_to?(:advices)}
268
+ #{Glue::Aspects.gen_advice_code(:og_read, klass.advices, :post) if klass.respond_to?(:advices)}
269
269
  end
270
270
  }
271
- end
271
+ end
272
272
 
273
273
  def eval_og_delete(klass)
274
274
  klass.module_eval %{
275
275
  def og_delete(store, pk, cascade = true)
276
- #{Aspects.gen_advice_code(:og_delete, klass.advices, :pre) if klass.respond_to?(:advices)}
276
+ #{Glue::Aspects.gen_advice_code(:og_delete, klass.advices, :pre) if klass.respond_to?(:advices)}
277
277
  pk ||= @#{klass.primary_key.first}
278
278
  transaction do |tx|
279
279
  tx.conn[#{klass}].delete(pk)
@@ -283,13 +283,13 @@ private
283
283
  end
284
284
  end
285
285
  end
286
- #{Aspects.gen_advice_code(:og_delete, klass.advices, :post) if klass.respond_to?(:advices)}
286
+ #{Glue::Aspects.gen_advice_code(:og_delete, klass.advices, :post) if klass.respond_to?(:advices)}
287
287
  end
288
- }
288
+ }
289
289
  end
290
290
 
291
291
  end
292
292
 
293
293
  end
294
294
 
295
- # * George Moschovitis <gm@navel.gr>
295
+ # * George Moschovitis <gm@navel.gr>