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
2ee87601
Commit
2ee87601
authored
Nov 26, 2014
by
John Hawthorn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "raise error for acts_as_paranoid on models without primary keys"
This reverts commit
6881e750
.
parent
c32a7c6b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
11 deletions
+0
-11
lib/paranoia.rb
+0
-1
test/paranoia_test.rb
+0
-10
No files found.
lib/paranoia.rb
View file @
2ee87601
...
...
@@ -154,7 +154,6 @@ end
class
ActiveRecord
::
Base
def
self
.
acts_as_paranoid
(
options
=
{})
raise
"primary key required for "
+
self
.
name
unless
self
.
primary_key
alias
:destroy!
:destroy
alias
:delete!
:delete
def
really_destroy!
...
...
test/paranoia_test.rb
View file @
2ee87601
...
...
@@ -28,7 +28,6 @@ def connect!
ActiveRecord
::
Base
.
connection
.
execute
'CREATE TABLE custom_column_models (id INTEGER NOT NULL PRIMARY KEY, destroyed_at DATETIME)'
ActiveRecord
::
Base
.
connection
.
execute
'CREATE TABLE custom_sentinel_models (id INTEGER NOT NULL PRIMARY KEY, deleted_at DATETIME NOT NULL)'
ActiveRecord
::
Base
.
connection
.
execute
'CREATE TABLE non_paranoid_models (id INTEGER NOT NULL PRIMARY KEY, parent_model_id INTEGER)'
ActiveRecord
::
Base
.
connection
.
execute
'CREATE TABLE idless_models (deleted_at DATETIME)'
end
class
WithDifferentConnection
<
ActiveRecord
::
Base
...
...
@@ -621,12 +620,6 @@ class ParanoiaTest < test_framework
assert_equal
3
,
parent
.
very_related_models
.
size
end
def
test_model_without_primary_key
assert_raises
(
RuntimeError
)
do
IdlessModel
.
class_eval
{
acts_as_paranoid
}
end
end
private
def
get_featureful_model
FeaturefulModel
.
new
(
:name
=>
"not empty"
)
...
...
@@ -765,6 +758,3 @@ class AsplodeModel < ActiveRecord::Base
raise
StandardError
,
'ASPLODE!'
end
end
class
IdlessModel
<
ActiveRecord
::
Base
end
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