parole 0.1 → 0.1.1

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: 4ee674fa482c0e5bdac4920a45ebe3cf3b432d6e
4
- data.tar.gz: 9ced8509fb977a20a4ae990dff8b6e508a65f489
3
+ metadata.gz: fa7a50452389b800759094aa18ff625260946c25
4
+ data.tar.gz: 4afa76b5ba285edae56a3715cf470fbdd6a57c47
5
5
  SHA512:
6
- metadata.gz: 8cbfe7a1ccfc90c130c331d195b545eb55b5bfb791c5b0d18d89c0253b180f082569abe3f7ca417d14c35a188a51e41b87cff0693ddc25e320b695e4e9ece3a5
7
- data.tar.gz: 3ed9ae68d461e3f721023eee4030ad167c46c037880d31f7677f502a9c772c158b58fd20c4329ae2e2e76d2aa268adffb0fbc3792550b8ea5b8606e09c99e235
6
+ metadata.gz: 874411296ab97a6e4e148e2c057f247ee4ba504c02072976d337c4c0cf93b66a94c036445bd70d1d28ee61d3c06878f377426bf65fb44f0c50a08b18cd69cfbf
7
+ data.tar.gz: 43c3227696e550314dad9f94627dba9b648b988468994a21b3c15493802d7dd48cff9bc12c6388b66b400cce7ae0a54f8caa736f7ca80d396aa2a3d6c922ca2a
@@ -3,7 +3,7 @@ class AddParole < ActiveRecord::Migration
3
3
  create_table :comments do |t|
4
4
  t.references :commentable, polymorphic: true
5
5
  t.references :commenter, polymorphic: true
6
- t.string :role, default: 'comment'
6
+ t.string :role
7
7
  t.text :comment
8
8
 
9
9
  t.timestamps
@@ -8,6 +8,8 @@ require 'parole/comment'
8
8
 
9
9
  class ActiveRecord::Base
10
10
  def self.acts_as_commentable(options = {})
11
+ Parole.commentable_classes << self
12
+
11
13
  class_attribute :commentable_options, :acts_as_commentable
12
14
  self.acts_as_commentable = true
13
15
  self.commentable_options = options.reverse_merge(roles: [])
@@ -24,3 +26,9 @@ class ActiveRecord::Base
24
26
  include Parole::Comment
25
27
  end
26
28
  end
29
+
30
+ module Parole
31
+ def self.commentable_classes
32
+ @commentable_classes ||= []
33
+ end
34
+ end
@@ -1,3 +1,3 @@
1
1
  module Parole
2
- VERSION = '0.1'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -14,6 +14,9 @@ RSpec.configure do |config|
14
14
  config.include ModelMacros
15
15
 
16
16
  config.before(:each) do
17
+ # Reset our commentable classes
18
+ Parole.instance_variable_set(:@commentable_classes, nil)
19
+
17
20
  # Create the SQLite database
18
21
  setup_database
19
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parole
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rémi Prévost