paranoid 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :patch: 4
3
2
  :major: 0
4
- :build:
5
3
  :minor: 0
4
+ :build:
5
+ :patch: 5
data/lib/paranoid/base.rb CHANGED
@@ -56,7 +56,7 @@ module Paranoid
56
56
 
57
57
  # Returns true if the model is paranoid and paranoid is enabled
58
58
  def paranoid?
59
- @paranoid = false unless defined?(@paranoid)
59
+ @paranoid = (self != ActiveRecord::Base && self.superclass.paranoid?) unless defined?(@paranoid)
60
60
  @paranoid
61
61
  end
62
62
  end
data/paranoid.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{paranoid}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David Genord II"]
12
- s.date = %q{2010-03-23}
12
+ s.date = %q{2010-07-28}
13
13
  s.description = %q{}
14
14
  s.email = %q{github@xspond.com}
15
15
  s.extra_rdoc_files = [
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
38
38
  s.homepage = %q{http://github.com/xspond/paranoid/}
39
39
  s.rdoc_options = ["--charset=UTF-8"]
40
40
  s.require_paths = ["lib"]
41
- s.rubygems_version = %q{1.3.6}
41
+ s.rubygems_version = %q{1.3.7}
42
42
  s.summary = %q{Enable soft delete of ActiveRecord records. Based off defunct ActsAsParanoid and IsParanoid}
43
43
  s.test_files = [
44
44
  "spec/models.rb",
@@ -51,7 +51,7 @@ Gem::Specification.new do |s|
51
51
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
52
52
  s.specification_version = 3
53
53
 
54
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
54
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
55
55
  s.add_runtime_dependency(%q<activerecord>, ["~> 3.0.0.beta"])
56
56
  else
57
57
  s.add_dependency(%q<activerecord>, ["~> 3.0.0.beta"])
data/spec/models.rb CHANGED
@@ -22,6 +22,9 @@ class Android < ActiveRecord::Base #:nodoc:
22
22
  end
23
23
  end
24
24
 
25
+ class Biped < Android
26
+ end
27
+
25
28
  class Dent < ActiveRecord::Base #:nodoc:
26
29
  paranoid
27
30
  belongs_to :android
@@ -34,6 +34,10 @@ describe Paranoid do
34
34
  Place.paranoid?.should be_true
35
35
  end
36
36
 
37
+ it 'should recognize an STI class as paranoid' do
38
+ Biped.paranoid?.should be_true
39
+ end
40
+
37
41
  it 'should hide destroyed records' do
38
42
  @tatooine.destroy
39
43
  Place.first(:conditions => {:name => 'Tatooine'}).should be_nil
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,15 @@ require 'paranoid'
6
6
  require 'yaml'
7
7
  require 'spec'
8
8
 
9
+ $enabled = false
10
+
11
+ ActiveSupport::Notifications.subscribe(/sql/i) do |*args|
12
+ if $enabled
13
+ event = ActiveSupport::Notifications::Event.new(*args)
14
+ puts "SQL #{event.duration}: #{event.payload[:sql]}"
15
+ end
16
+ end
17
+
9
18
  def connect(environment)
10
19
  conf = YAML::load(File.open(File.dirname(__FILE__) + '/database.yml'))
11
20
  ActiveRecord::Base.establish_connection(conf[environment])
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paranoid
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 21
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 4
9
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - David Genord II
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-03-23 00:00:00 -04:00
18
+ date: 2010-07-28 00:00:00 -04:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: activerecord
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 31098225
27
30
  segments:
28
31
  - 3
29
32
  - 0
@@ -69,23 +72,27 @@ rdoc_options:
69
72
  require_paths:
70
73
  - lib
71
74
  required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
72
76
  requirements:
73
77
  - - ">="
74
78
  - !ruby/object:Gem::Version
79
+ hash: 3
75
80
  segments:
76
81
  - 0
77
82
  version: "0"
78
83
  required_rubygems_version: !ruby/object:Gem::Requirement
84
+ none: false
79
85
  requirements:
80
86
  - - ">="
81
87
  - !ruby/object:Gem::Version
88
+ hash: 3
82
89
  segments:
83
90
  - 0
84
91
  version: "0"
85
92
  requirements: []
86
93
 
87
94
  rubyforge_project:
88
- rubygems_version: 1.3.6
95
+ rubygems_version: 1.3.7
89
96
  signing_key:
90
97
  specification_version: 3
91
98
  summary: Enable soft delete of ActiveRecord records. Based off defunct ActsAsParanoid and IsParanoid