comment_me 0.1.1alpha → 0.2.0alpha
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/comment_me/acts_as_commentable.rb +1 -0
- data/lib/comment_me/models/comment.rb +5 -6
- data/lib/comment_me/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 802fa515fa94d77a1d6a77fd3532ba753122c179fa81fb666255f4c36642eb10
|
4
|
+
data.tar.gz: 34afe2f0aa06c90e230b2e6196721f3167da3a4b82ece86a75a6107097dbc878
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2056f0677fa192405518a3243ef831ac1eb952f4136e6df36fbc5920ad5bd5fb48df4dee434ea2d8b8b3fb14880d67b099bfda3ec12ef092790855ddbb5df4e2
|
7
|
+
data.tar.gz: eee9c37ad5990466bff0b2935cf41ccdf42237448211c7184cf00a7c7a15205335d483fb972e994813c7967b85eb66c80fbbd66b06a63e8aa706e5426f4fefbd
|
data/README.md
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
class Comment < ActiveRecord::Base
|
2
2
|
|
3
3
|
# => associations
|
4
|
-
belongs_to :entity, polymorphic: true
|
4
|
+
belongs_to :entity, polymorphic: true
|
5
5
|
belongs_to :comment, optional: true
|
6
6
|
has_many :comments, dependent: :destroy
|
7
7
|
|
8
8
|
# => Validations
|
9
9
|
validates_presence_of :emitter, :message
|
10
|
-
|
10
|
+
|
11
|
+
# => callback
|
12
|
+
after_create :entity_existence
|
11
13
|
|
12
14
|
# => *
|
13
15
|
def entity_exist?
|
@@ -24,10 +26,7 @@ class Comment < ActiveRecord::Base
|
|
24
26
|
# => *
|
25
27
|
def entity_existence
|
26
28
|
unless entity_exist?
|
27
|
-
|
28
|
-
:entity,
|
29
|
-
"#{entity_type} doesn't have association with Comment or there's no record in #{entity_type} witn id=#{entity_id}"
|
30
|
-
)
|
29
|
+
raise ActiveRecord::Rollback
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
data/lib/comment_me/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comment_me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0alpha
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Armando Alejandre
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|