acts_as_paranoid 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -80,7 +80,7 @@ Recovery is easy. Just invoke `recover` on it, like this:
80
80
  ```ruby
81
81
  Paranoiac.only_deleted.where("name = ?", "not dead yet").first.recover
82
82
  ```
83
-
83
+
84
84
  All associations marked as `:dependent => :destroy` are also recursively recovered. If you would like to disable this behavior, you can call `recover` with the `recursive` option:
85
85
 
86
86
  ```ruby
@@ -106,7 +106,7 @@ end
106
106
  class Paranoid < ActiveRecord::Base
107
107
  belongs_to :paranoic
108
108
 
109
- # Paranoid objects will be recovered alongside Paranoic objects
109
+ # Paranoid objects will be recovered alongside Paranoic objects
110
110
  # if they were deleted within 10 minutes of the Paranoic object
111
111
  acts_as_paranoid :dependent_recovery_window => 10.minutes
112
112
  end
@@ -127,14 +127,14 @@ class Paranoiac < ActiveRecord::Base
127
127
  validates_as_paranoid
128
128
  validates_uniqueness_of_without_deleted :name
129
129
  end
130
-
130
+
131
131
  p1 = Paranoiac.create(:name => 'foo')
132
132
  p1.destroy
133
-
134
- p2 = Paranoiac.new(:name => 'foo')
133
+
134
+ p2 = Paranoiac.new(:name => 'foo')
135
135
  p2.valid? #=> true
136
136
  p2.save
137
-
137
+
138
138
  p1.recover #=> fails validation!
139
139
  ```
140
140
 
@@ -145,7 +145,7 @@ You can check the status of your paranoid objects with the `deleted?` helper
145
145
  Paranoiac.create(:name => 'foo').destroy
146
146
  Paranoiac.with_deleted.first.deleted? #=> true
147
147
  ```
148
-
148
+
149
149
  ### Scopes
150
150
 
151
151
  As you've probably guessed, `with_deleted` and `only_deleted` are scopes. You can, however, chain them freely with other scopes you might have. This
@@ -167,15 +167,15 @@ class Paranoiac < ActiveRecord::Base
167
167
  acts_as_paranoid
168
168
  scope :pretty, where(:pretty => true)
169
169
  end
170
-
170
+
171
171
  Paranoiac.create(:pretty => true)
172
-
172
+
173
173
  Paranoiac.pretty.count #=> 1
174
174
  Paranoiac.only_deleted.count #=> 0
175
175
  Paranoiac.pretty.only_deleted.count #=> 0
176
-
176
+
177
177
  Paranoiac.first.destroy
178
-
178
+
179
179
  Paranoiac.pretty.count #=> 0
180
180
  Paranoiac.only_deleted.count #=> 1
181
181
  Paranoiac.pretty.only_deleted.count #=> 1
@@ -189,16 +189,16 @@ Associations are also supported. From the simplest behaviors you'd expect to mor
189
189
  class ParanoiacParent < ActiveRecord::Base
190
190
  has_many :children, :class_name => "ParanoiacChild"
191
191
  end
192
-
192
+
193
193
  class ParanoiacChild < ActiveRecord::Base
194
194
  belongs_to :parent, :class_name => "ParanoiacParent"
195
195
  belongs_to :parent_with_deleted, :class_name => "ParanoiacParent", :with_deleted => true
196
196
  end
197
-
198
- parent = ParanoiacParent.first
197
+
198
+ parent = ParanoiacParent.first
199
199
  child = parent.children.create
200
200
  parent.destroy
201
-
201
+
202
202
  child.parent #=> nil
203
203
  child.parent_with_deleted #=> ParanoiacParent (it works!)
204
204
  ```
@@ -218,9 +218,9 @@ This gem supports the most recent versions of Rails and Ruby.
218
218
  ## Rails
219
219
 
220
220
  For Rails 3.2 check the README at the [rails3.2](https://github.com/goncalossilva/rails3_acts_as_paranoid/tree/rails3.2) branch and add this to your Gemfile:
221
-
222
- gem "rails3_acts_as_paranoid", "~>0.2.0"
223
-
221
+
222
+ gem "acts_as_paranoid", "~>0.4.0"
223
+
224
224
  For Rails 3.1 check the README at the [rails3.1](https://github.com/goncalossilva/rails3_acts_as_paranoid/tree/rails3.1) branch and add this to your Gemfile:
225
225
 
226
226
  gem "rails3_acts_as_paranoid", "~>0.1.4"
@@ -228,8 +228,8 @@ For Rails 3.1 check the README at the [rails3.1](https://github.com/goncalossilv
228
228
  For Rails 3.0 check the README at the [rails3.0](https://github.com/goncalossilva/rails3_acts_as_paranoid/tree/rails3.0) branch and add this to your Gemfile:
229
229
 
230
230
  gem "rails3_acts_as_paranoid", "~>0.0.9"
231
-
232
-
231
+
232
+
233
233
  ## Ruby
234
234
 
235
235
  This gem is tested on Ruby 1.9, JRuby and Rubinius (both in 1.9 mode). It *might* work fine in 1.8, but it's not officially supported.
@@ -240,8 +240,7 @@ This gem is tested on Ruby 1.9, JRuby and Rubinius (both in 1.9 mode). It *might
240
240
  * To [Jonathan Vaught](https://github.com/gravelpup) for adding paranoid validations
241
241
  * To [Geoffrey Hichborn](https://github.com/phene) for improving the overral code quality and adding support for after_commit
242
242
  * To [flah00](https://github.com/flah00) for adding support for STI-based associations (with :dependent)
243
- * To [vikramdhillon](https://github.com/vikramdhillon) for the idea and
244
- initial implementation of support for string column type
243
+ * To [vikramdhillon](https://github.com/vikramdhillon) for the idea and initial implementation of support for string column type
245
244
  * To [Craig Walker](https://github.com/softcraft-development) for Rails 3.1 support and fixing various pending issues
246
245
  * To [Charles G.](https://github.com/chuckg) for Rails 3.2 support and for making a desperately needed global code refactoring
247
246
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_paranoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-12-09 00:00:00.000000000 Z
14
+ date: 2012-12-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activerecord
18
- requirement: &70256076943380 !ruby/object:Gem::Requirement
18
+ requirement: &70150388871560 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,7 +23,7 @@ dependencies:
23
23
  version: '3.2'
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70256076943380
26
+ version_requirements: *70150388871560
27
27
  description: Active Record (~>3.2) plugin which allows you to hide and restore records
28
28
  without actually deleting them. Check its GitHub page for more in-depth information.
29
29
  email:
@@ -36,7 +36,7 @@ files:
36
36
  - lib/acts_as_paranoid/core.rb
37
37
  - lib/acts_as_paranoid/relation.rb
38
38
  - lib/acts_as_paranoid/validations.rb
39
- - lib/rails3_acts_as_paranoid.rb
39
+ - lib/acts_as_paranoid.rb
40
40
  - LICENSE
41
41
  - README.markdown
42
42
  homepage: https://github.com/goncalossilva/rails3_acts_as_paranoid
@@ -53,7 +53,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  segments:
55
55
  - 0
56
- hash: -309367461026455685
56
+ hash: -1045242170192102573
57
57
  required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  none: false
59
59
  requirements: