immortal 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 60ac9bd43b41aa290750329470ab9cd76e8adcb3
4
- data.tar.gz: a779e1fb76253a4148f62e186c347be7ed19c847
3
+ metadata.gz: 487cc9848fc342f7f15e64970c3f470462396991
4
+ data.tar.gz: 271bf192210787e34fbb19c642178ddde59f587c
5
5
  SHA512:
6
- metadata.gz: 34bddc9c389145c501948b6255821a30424cd126fca8e6367a1ee65f7d99d32ea96fe53c684575d3c0c184f9c962fca802c1786e351e6b65d4ce858669ad70cf
7
- data.tar.gz: a34d764cdc236d6cb6f055c32bdeb2eab35448390171af5988eaa0accca696e2a843d87f683cd65a9f753624b97168fb1569e5d4994c8ddfd4e85fb9bdda9db2
6
+ metadata.gz: 0edc1fa5dba903469dbc21284009b4edf3f62dbb1eeaaec32078d6ba591705da2d40de0ae6eab9d92d6a55b8a2d35a7f6282001e9cd492dc9808416f24d8768a
7
+ data.tar.gz: 5deeee14ae09920532785f3b64d98d6579436274982ae2772508c779ac992a6973028b407dab0af4fd5ccaa1f2a9d76b6c08ba4b6ece4a5b90de11ef93473f3a
data/.gitignore CHANGED
@@ -3,3 +3,6 @@ pkg/*
3
3
  .bundle
4
4
  .Gemfile.lock
5
5
  Gemfile.lock
6
+ bin
7
+ spec/examples.txt
8
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --require spec_helper
2
+ --format progress
3
+ --color
@@ -0,0 +1 @@
1
+ require: 'rubocop-rspec'
@@ -0,0 +1,114 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/).
6
+
7
+ ## [3.0.0]
8
+ ### Added
9
+
10
+ - Modern gem management
11
+ - Contributor Covenant CoC
12
+
13
+ ### Changed
14
+
15
+ - Upgraded rspec and tests syntax
16
+
17
+ ### Deprecated
18
+
19
+ - Rails versions smaller than 4.1.x
20
+
21
+ ### Removed
22
+
23
+ - Support for rails versions below 4.1.x
24
+
25
+ ### Fixed
26
+ ### Security
27
+
28
+ ## [2.0.0]
29
+ ### Deprecated
30
+
31
+ - Rails versions smaller than 4.0.x
32
+
33
+ ### Removed
34
+
35
+ - Support for rails versions below 4.0.x
36
+
37
+ ## [1.0.5]
38
+
39
+ ### Changed
40
+
41
+ - Use separate internal accessors for with/only_deleted singular association readers
42
+
43
+ ## [1.0.4]
44
+ ### Changed
45
+
46
+ - Extract with_deleted singular assoc readers to separate module
47
+
48
+ ## [1.0.3]
49
+ ### Added
50
+
51
+ - Added back feature where using immortal finders doesn't unscope association scopes.
52
+
53
+ ## [1.0.2]
54
+ ### Added
55
+
56
+ - Added with/only_deleted singular association readers (see specs)
57
+
58
+ ## [1.0.1]
59
+ ### Added
60
+
61
+ - Made compatible with Rails 3.1.X
62
+
63
+ ## [1.0.0]
64
+ ### Changed
65
+
66
+ - Changed the API, made it compatible with Rails 3.1, removed functionality
67
+
68
+ ## [0.1.6]
69
+ ### Fixed
70
+
71
+ - issue 2: with_deleted breaks associations
72
+
73
+ ## [0.1.5]
74
+ ### Added
75
+
76
+ - "without deleted" scope to join model by overriding
77
+ HasManyThroughAssociation#construct_conditions rather than simply adding to
78
+ has_many conditions.
79
+
80
+ ## [0.1.4]
81
+ ### Fixed
82
+
83
+ - Bug where ALL records of any dependent associations were immortally deleted if
84
+ assocation has `:dependant => :delete_all` option set
85
+
86
+ ## [0.1.3]
87
+ ### Fixed
88
+
89
+ - Bug where join model is not immortal
90
+
91
+ ## [0.1.2]
92
+ ### Fixed
93
+
94
+ - Loading issue when the `deleted` column doesn't exist (or even the table)
95
+
96
+ ## [0.1.1]
97
+ ### Fixed
98
+
99
+ - Behavior with `has_many :through` associations
100
+
101
+ [Unreleased]: https://github.com/teambox/immortal/compare/v3.0.0...HEAD
102
+ [3.0.0]: https://github.com/teambox/immortal/compare/v2.0.0...v3.0.0
103
+ [2.0.0]: https://github.com/teambox/immortal/compare/v1.0.5...v2.0.0
104
+ [1.0.5]: https://github.com/teambox/immortal/compare/v1.0.4...v1.0.5
105
+ [1.0.4]: https://github.com/teambox/immortal/compare/v1.0.3...v1.0.4
106
+ [1.0.3]: https://github.com/teambox/immortal/compare/v1.0.2...v1.0.3
107
+ [1.0.2]: https://github.com/teambox/immortal/compare/v1.0.1...v1.0.2
108
+ [1.0.1]: https://github.com/teambox/immortal/compare/v1.0.0...v1.0.1
109
+ [1.0.0]: https://github.com/teambox/immortal/compare/v0.1.6...v1.0.0
110
+ [0.1.6]: https://github.com/teambox/immortal/compare/v0.1.5...v0.1.6
111
+ [0.1.5]: https://github.com/teambox/immortal/compare/v0.1.4...v0.1.5
112
+ [0.1.4]: https://github.com/teambox/immortal/compare/v0.1.3...v0.1.4
113
+ [0.1.3]: https://github.com/teambox/immortal/compare/v0.1.2...v0.1.3
114
+ [0.1.2]: https://github.com/teambox/immortal/compare/v0.1.1...v0.1.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at nflamel@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "http://rubygems.org"
1
+ source 'http://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in immortal.gemspec
4
4
  gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Redbooth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -1,30 +1,38 @@
1
1
  # Immortal
2
2
 
3
- Make any ActiveRecord model paranoid by just including `Immortal`, and instead of being deleted from the database, the object will just marked as 'deleted' with a boolean field in the database.
3
+ Make any ActiveRecord model paranoid by just including `Immortal`, and instead
4
+ of being deleted from the database, the object will just marked as 'deleted'
5
+ with a boolean field in the database.
4
6
 
5
7
  ## Installation
6
8
 
7
9
  Add the gem dependency to your Gemfile:
8
10
 
9
- gem 'immortal'
11
+ ```ruby
12
+ gem 'immortal'
13
+ ```
10
14
 
11
15
  ## Usage
12
16
 
13
- class User < ActiveRecord::Base
14
- include Immortal
15
- end
17
+ ```ruby
18
+ class User < ActiveRecord::Base
19
+ include Immortal
20
+ end
21
+ ```
16
22
 
17
23
  And add a boolean field called `deleted` to that model:
18
24
 
19
- class AddDeletedToUsers < ActiveRecord::Migration
20
- def self.up
21
- add_column :users, :deleted, :boolean
22
- end
25
+ ```ruby
26
+ class AddDeletedToUsers < ActiveRecord::Migration
27
+ def self.up
28
+ add_column :users, :deleted, :boolean
29
+ end
23
30
 
24
- def self.down
25
- remove_column :users, :deleted
26
- end
27
- end
31
+ def self.down
32
+ remove_column :users, :deleted
33
+ end
34
+ end
35
+ ```
28
36
 
29
37
  ## TODO
30
38
 
@@ -38,34 +46,3 @@ If you want to improve immortal
38
46
  2. Create a topic branch `git checkout -b my_feature`
39
47
  3. Push it! `git push origin my_feature`
40
48
  4. Open a pull request
41
-
42
- ## CHANGELOG
43
-
44
- - 1.0.5 Use separate internal accessors for with/only_deleted singular association readers
45
- - 1.0.4 Extract with_deleted singular assoc readers to separate module
46
- - 1.0.3 Added back feature where using immortal finders doesn't unscope association scopes.
47
- - 1.0.2 Added with/only_deleted singular association readers (see specs)
48
- - 1.0.1 Made compatible with Rails 3.1.X
49
- - 1.0.0 Changed the API, made it compatible with Rails 3.1, removed
50
- functionality
51
- - 0.1.6 Fixing immortal issue 2: with_deleted breaks associations
52
- - 0.1.5 Add "without deleted" scope to join model by overriding HasManyThroughAssociation#construct_conditions
53
- rather than simply adding to has_many conditions.
54
- - 0.1.4 fix bug where ALL records of any dependent associations were
55
- immortally deleted if assocation has :dependant => :delete_all option
56
- set
57
- - 0.1.3 fix bug where join model is not immortal
58
- - 0.1.2 fix loading issue when the `deleted` column doesn't exist (or even the table)
59
- - 0.1.1 fix behavior with `has_many :through` associations
60
-
61
- ## License
62
-
63
- (The MIT License)
64
-
65
- Copyright (c) Teambox
66
-
67
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
68
-
69
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
70
-
71
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require 'bundler'
2
- Bundler::GemHelper.install_tasks
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -1,28 +1,35 @@
1
- # -*- encoding: utf-8 -*-
2
- $LOAD_PATH.push File.expand_path('../lib', __FILE__)
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'immortal/version'
3
5
 
4
- Gem::Specification.new do |s|
5
- s.name = 'immortal'
6
- s.version = '2.0.0'
7
- s.authors = [
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'immortal'
8
+ spec.version = Immortal::VERSION
9
+ spec.authors = [
8
10
  'Jordi Romero', 'Saimon Moore', 'Pau Ramon', 'Carlos Saura', 'Andres Bravo',
9
11
  'Fran Casas', 'Pau Perez'
10
12
  ]
11
- s.email = ['jordi@jrom.net', 'saimon@saimonmoore.net']
12
- s.homepage = 'http://github.com/teambox/immortal'
13
- s.summary = 'Replacement for acts_as_paranoid for Rails 4'
14
- s.description = 'Typical paranoid gem built for Rails 4 and with the ' \
15
- "minimum code needed to satisfy acts_as_paranoid's API"
16
- s.license = 'MIT'
13
+ spec.email = ['jordi@jrom.net', 'saimon@saimonmoore.net']
14
+ spec.homepage = 'http://github.com/teambox/immortal'
15
+ spec.summary = 'Replacement for acts_as_paranoid for Rails 4'
16
+ spec.description = 'Typical paranoid gem built for Rails 4 and with the ' \
17
+ "minimum code needed to satisfy acts_as_paranoid's API"
18
+ spec.license = 'MIT'
17
19
 
18
- s.files = `git ls-files`.split("\n")
19
- s.test_files = `git ls-files -- {spec}/*`.split("\n")
20
- s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
21
- s.require_paths = ['lib']
20
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
21
+ f.match(%r{^(test|spec|features)/})
22
+ end
23
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
+ spec.require_paths = %w[lib]
22
25
 
23
- s.add_dependency 'activerecord', '~> 4.0.0'
24
- s.add_development_dependency 'rspec', '~> 2.6.0'
25
- s.add_development_dependency 'sqlite3'
26
- s.add_development_dependency 'byebug'
27
- s.add_development_dependency 'rake', '~> 10.0'
26
+ spec.add_dependency 'activerecord', '~> 4.1.0'
27
+ spec.add_development_dependency 'rspec', '~> 3.6.0'
28
+ spec.add_development_dependency 'rspec-its'
29
+ spec.add_development_dependency 'sqlite3'
30
+ spec.add_development_dependency 'byebug'
31
+ spec.add_development_dependency 'rake', '~> 10.0'
32
+ spec.add_development_dependency 'rubocop'
33
+ spec.add_development_dependency 'rubocop-rspec'
34
+ spec.add_development_dependency 'reek'
28
35
  end
@@ -1,31 +1,34 @@
1
1
  require 'immortal/belongs_to'
2
2
 
3
+ # Include +Immortal+ module to activate soft delete on your model.
3
4
  module Immortal
5
+ COLUMN_NAME = 'deleted'.freeze
4
6
 
5
7
  def self.included(base)
6
8
  base.send :extend, ClassMethods
7
9
  base.send :include, InstanceMethods
8
10
  base.send :include, BelongsTo
11
+
9
12
  base.class_eval do
10
13
  class << self
11
- alias :mortal_delete_all :delete_all
12
- alias :delete_all :immortal_delete_all
14
+ alias_method :mortal_delete_all, :delete_all
15
+ alias_method :delete_all, :immortal_delete_all
13
16
  end
14
17
  end
15
18
  end
16
19
 
17
20
  module ClassMethods
18
-
21
+ # @return [Boolean] whether the model supports immortal or not
19
22
  def immortal?
20
- self.included_modules.include?(::Immortal::InstanceMethods)
23
+ included_modules.include?(::Immortal::InstanceMethods)
21
24
  end
22
25
 
23
26
  def without_default_scope
24
- new_scope = self.unscoped
25
- our_scope = self.current_scope || self.unscoped
27
+ new_scope = unscoped
28
+ our_scope = current_scope || unscoped
26
29
 
27
30
  non_immortal_constraints_sql = our_scope.arel.constraints.to_a.map do |constraint|
28
- constraint.to_sql.split('AND').reject{|clause| clause.include?('deleted')}
31
+ constraint.to_sql.split('AND').reject { |clause| clause.include?(COLUMN_NAME) }
29
32
  end.flatten.join(' AND ')
30
33
 
31
34
  new_scope = new_scope.merge(our_scope.except(:where))
@@ -37,7 +40,7 @@ module Immortal
37
40
  end
38
41
 
39
42
  def exists?(id = false)
40
- where(deleted: false).exists?(id)
43
+ mortal.exists?(id)
41
44
  end
42
45
 
43
46
  def count_with_deleted(*args)
@@ -48,38 +51,24 @@ module Immortal
48
51
 
49
52
  def count_only_deleted(*args)
50
53
  without_default_scope do
51
- where(deleted: true).count(*args)
54
+ immortal.count(*args)
52
55
  end
53
56
  end
54
57
 
55
- def where_with_deleted(*args)
58
+ def where_with_deleted(conditions)
56
59
  without_default_scope do
57
- where(*args)
60
+ where(conditions)
58
61
  end
59
62
  end
60
63
 
61
- def find_with_deleted(*args)
62
- ActiveSupport::Deprecation.warn('[immortal] we are deprecating #find_with_deleted use where_with_deleted instead')
64
+ def where_only_deleted(conditions)
63
65
  without_default_scope do
64
- find(*args)
65
- end
66
- end
67
-
68
- def where_only_deleted(*args)
69
- without_default_scope do
70
- where(deleted: true).where(args)
71
- end
72
- end
73
-
74
- def find_only_deleted(*args)
75
- ActiveSupport::Deprecation.warn('[immortal] we are deprecating #find_only_deleted use where_only_deleted instead')
76
- without_default_scope do
77
- where(deleted: true).find(*args)
66
+ immortal.where(conditions)
78
67
  end
79
68
  end
80
69
 
81
70
  def immortal_delete_all(conditions = nil)
82
- unscoped.where(conditions).update_all(deleted: 1)
71
+ unscoped.where(conditions).update_all(COLUMN_NAME => 1)
83
72
  end
84
73
 
85
74
  def delete_all!(*args)
@@ -87,26 +76,31 @@ module Immortal
87
76
  end
88
77
 
89
78
  def undeleted_clause_sql
90
- unscoped.where(deleted: false).constraints.first.to_sql
79
+ unscoped.mortal.constraints.first.to_sql
91
80
  end
92
81
 
93
82
  def deleted_clause_sql
94
- unscoped.where(arel_table[:deleted].eq(true)).constraints.first.to_sql
83
+ unscoped.where(arel_table[COLUMN_NAME].eq(true)).constraints.first.to_sql
95
84
  end
96
-
97
85
  end
98
86
 
99
87
  module InstanceMethods
100
88
  def self.included(base)
101
- unless base.table_exists? && base.columns_hash["deleted"] && !base.columns_hash["deleted"].null
102
- Kernel.warn "[Immortal] The 'deleted' column in #{base.to_s} is nullable, change the column to not accept NULL values"
89
+ unless base.table_exists? && base.columns_hash[COLUMN_NAME] && !base.columns_hash[COLUMN_NAME].null
90
+ Kernel.warn(
91
+ "[Immortal] The '#{COLUMN_NAME}' column in #{base} is nullable, " \
92
+ 'change the column to not accept NULL values'
93
+ )
103
94
  end
104
95
 
105
96
  base.class_eval do
106
- default_scope { ->{ where(deleted: false) } } if arel_table[:deleted]
97
+ scope(:mortal, -> { where(COLUMN_NAME => false) })
98
+ scope(:immortal, -> { where(COLUMN_NAME => true) })
107
99
 
108
- alias :mortal_destroy :destroy
109
- alias :destroy :immortal_destroy
100
+ default_scope { -> { mortal } } if arel_table[COLUMN_NAME]
101
+
102
+ alias_method :mortal_destroy, :destroy
103
+ alias_method :destroy, :immortal_destroy
110
104
  end
111
105
  end
112
106
 
@@ -123,23 +117,35 @@ module Immortal
123
117
  end
124
118
 
125
119
  def destroy_without_callbacks
126
- self.class.unscoped.where(id: id).update_all(deleted: true, updated_at: current_time_from_proper_timezone)
120
+ scoped_record.update_all(
121
+ COLUMN_NAME => true,
122
+ updated_at: current_time_from_proper_timezone
123
+ )
124
+
127
125
  @destroyed = true
128
126
  reload
129
127
  freeze
130
128
  end
131
129
 
132
130
  def recover!
133
- self.class.unscoped.where(id: id).update_all(deleted: false, updated_at: current_time_from_proper_timezone)
131
+ scoped_record.update_all(
132
+ COLUMN_NAME => false,
133
+ updated_at: current_time_from_proper_timezone
134
+ )
135
+
134
136
  @destroyed = false
135
137
  reload
136
138
  end
137
139
 
138
140
  private
139
141
 
142
+ # @return [ActiveRecord::Relation]
143
+ def scoped_record
144
+ self.class.unscoped.where(id: id)
145
+ end
146
+
140
147
  def current_time_from_proper_timezone
141
148
  ActiveRecord::Base.default_timezone == :utc ? Time.now.utc : Time.now
142
149
  end
143
-
144
150
  end
145
151
  end