Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paranoia
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paranoia
Commits
c2a1dfac
Commit
c2a1dfac
authored
9 years ago
by
Claessens Simon
Committed by
John Hawthorn
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use module.prepend instead of alias_method_chain
parent
fc4cec00
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
lib/paranoia.rb
+7
-5
No files found.
lib/paranoia.rb
View file @
c2a1dfac
...
...
@@ -261,14 +261,16 @@ require 'paranoia/rspec' if defined? RSpec
module
ActiveRecord
module
Validations
class
UniquenessValidator
<
ActiveModel
::
EachValidator
protected
def
build_relation_with_paranoia
(
klass
,
table
,
attribute
,
value
)
relation
=
build_relation_without_paranoia
(
klass
,
table
,
attribute
,
value
)
module
UniquenessParanoiaValidator
def
build_relation
(
klass
,
table
,
attribute
,
value
)
relation
=
super
(
klass
,
table
,
attribute
,
value
)
return
relation
unless
klass
.
respond_to?
(
:paranoia_column
)
relation
.
and
(
klass
.
arel_table
[
klass
.
paranoia_column
].
eq
(
klass
.
paranoia_sentinel_value
))
end
alias_method_chain
:build_relation
,
:paranoia
end
class
UniquenessValidator
<
ActiveModel
::
EachValidator
prepend
UniquenessParanoiaValidator
end
end
end
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment