simple_record 1.1.30 → 1.1.31

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 (3) hide show
  1. data/lib/callbacks.rb +27 -0
  2. data/lib/simple_record.rb +7 -16
  3. metadata +2 -1
data/lib/callbacks.rb ADDED
@@ -0,0 +1,27 @@
1
+ module SimpleRecord::Callbacks
2
+ #this bit of code creates a "run_blank" function for everything value in the @@callbacks array.
3
+ #this function can then be inserted in the appropriate place in the save, new, destroy, etc overrides
4
+ #basically, this is how we recreate the callback functions
5
+ @@callbacks=["before_validation", "before_validation_on_create", "before_validation_on_update",
6
+ "after_validation", "after_validation_on_create", "after_validation_on_update",
7
+ "before_save", "before_create", "before_update",
8
+ "after_create", "after_update", "after_save",
9
+ "after_destroy"]
10
+
11
+ def self.included(base)
12
+ #puts 'Callbacks included in ' + base.inspect
13
+
14
+ end
15
+
16
+ def before_delete()
17
+ end
18
+
19
+ def after_delete()
20
+ end
21
+
22
+ def before_destroy()
23
+ end
24
+
25
+ def after_destroy()
26
+ end
27
+ end
data/lib/simple_record.rb CHANGED
@@ -27,6 +27,7 @@ require 'sdb/active_sdb'
27
27
  #require 'results_array' # why the heck isn't this picking up???
28
28
  require File.expand_path(File.dirname(__FILE__) + "/results_array")
29
29
  require File.expand_path(File.dirname(__FILE__) + "/stats")
30
+ require File.expand_path(File.dirname(__FILE__) + "/callbacks")
30
31
 
31
32
  module SimpleRecord
32
33
 
@@ -59,22 +60,6 @@ module SimpleRecord
59
60
  RightAws::ActiveSdb.close_connection
60
61
  end
61
62
 
62
- module Callbacks
63
- #this bit of code creates a "run_blank" function for everything value in the @@callbacks array.
64
- #this function can then be inserted in the appropriate place in the save, new, destroy, etc overrides
65
- #basically, this is how we recreate the callback functions
66
- @@callbacks=["before_validation", "before_validation_on_create", "before_validation_on_update",
67
- "after_validation", "after_validation_on_create", "after_validation_on_update",
68
- "before_save", "before_create", "before_update",
69
- "after_create", "after_update", "after_save",
70
- "after_destroy"]
71
-
72
- def self.included(base)
73
- #puts 'Callbacks included in ' + base.inspect
74
-
75
- end
76
- end
77
-
78
63
  class Base < Aws::ActiveSdb::Base
79
64
 
80
65
  include SimpleRecord::Callbacks
@@ -784,6 +769,12 @@ module SimpleRecord
784
769
  connection.delete_attributes(domain, id)
785
770
  end
786
771
 
772
+ def delete
773
+ before_delete
774
+ super
775
+ after_delete
776
+ end
777
+
787
778
  def delete_niled(to_delete)
788
779
  # puts 'to_delete=' + to_delete.inspect
789
780
  if to_delete.size > 0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.30
4
+ version: 1.1.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
@@ -33,6 +33,7 @@ extensions: []
33
33
  extra_rdoc_files:
34
34
  - README.markdown
35
35
  files:
36
+ - lib/callbacks.rb
36
37
  - lib/results_array.rb
37
38
  - lib/simple_record.rb
38
39
  - lib/stats.rb