digitalmoksha-acts_as_commentable 6.0.0 → 8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +4 -22
  3. data/lib/commentable_methods.rb +12 -17
  4. metadata +4 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 56dc4bcd0dd16afe10a81b998bf36267c8a8aedab7069d8e3d7e1d9d19b64f9d
4
- data.tar.gz: 22fa27c7b332d124e602ca69a2703691ce32f8a91741c0ae014d4869631e2073
3
+ metadata.gz: 835ebde56a03a3628011fcc2eec83d7f5baa9fc5f63e6520362dfb5a648533de
4
+ data.tar.gz: 6c8290f6840b236cca2287aad23d980a4cd6a98e19d8ec7838f36863b6625233
5
5
  SHA512:
6
- metadata.gz: e093162809f535495672ba6495e35fcd321378245295028777687a4c104eadb19c4c3a4be428ad8f093bacb64a7ceae25a57960ee2bc24cbc34320984f13a393
7
- data.tar.gz: c25216c0cb22b50f57680e951b2c9ac955e274b77832de05e8fa7738fe6d0d0e4a28497fd2a5bc52a2defb90d3cb3cf7c06997303f2e2996c246fc1bbeafd34c
6
+ metadata.gz: 7fd6ece1a9d6245cecc225503c7cadd82aeb46c3f90777a67305416166059001f5488d00b784c7e53956320644055e9c28e33daae913e86668b18d38b30d9895
7
+ data.tar.gz: 257a0003a657260bb01cfea38e77517d375cbbb0cffbf3ffbea4f2f7e9690ef97e830b45e23581ba125b955dd5a17fcb3ffcb5c5e56980b079c718c636f5cb7e
data/README.rdoc CHANGED
@@ -9,30 +9,12 @@ commentable models.
9
9
 
10
10
  Add the following line to your Gemfile
11
11
 
12
- === Rails 4
13
-
14
12
  gem 'acts_as_commentable'
15
13
 
16
- === Rails 3
17
-
18
- gem 'acts_as_commentable', '3.0.1'
19
-
20
- === Rails 2
21
-
22
- gem 'acts_as_commentable', git: 'git@github.com:jackdempsey/acts_as_commentable.git', branch: '2.x'
23
-
24
-
25
14
  == Generator
26
15
 
27
-
28
- === Rails 3+
29
-
30
16
  rails g comment
31
17
 
32
- === Rails 2
33
-
34
- script/generate comment
35
-
36
18
  Then migrate your database to add the comments model:
37
19
 
38
20
  rake db:migrate
@@ -40,13 +22,13 @@ Then migrate your database to add the comments model:
40
22
  == Usage
41
23
 
42
24
  Make the desired ActiveRecord model act as commentable:
43
-
25
+
44
26
  class Post < ActiveRecord::Base
45
27
  acts_as_commentable
46
28
  end
47
29
 
48
30
  Add a comment to a model instance by adding the following to the controller:
49
-
31
+
50
32
  commentable = Post.create
51
33
  comment = commentable.comments.create
52
34
  comment.title = "First comment."
@@ -55,12 +37,12 @@ Add a comment to a model instance by adding the following to the controller:
55
37
 
56
38
 
57
39
  Fetch comments for the commentable model by adding the following to the view:
58
-
40
+
59
41
  commentable = Post.find(1)
60
42
  comments = commentable.comments.recent.limit(10).all
61
43
 
62
44
  You can also add different types of comments to a model:
63
-
45
+
64
46
  class Todo < ActiveRecord::Base
65
47
  acts_as_commentable :public, :private
66
48
  end
@@ -15,23 +15,6 @@ module Juixe
15
15
  send("define_role_based_inflection_#{Rails.version.first}", role)
16
16
  end
17
17
 
18
- def define_role_based_inflection_3(role)
19
- has_many "#{role.to_s}_comments".to_sym,
20
- has_many_options(role).merge(:conditions => { role: role.to_s })
21
- end
22
-
23
- def define_role_based_inflection_4(role)
24
- has_many "#{role.to_s}_comments".to_sym,
25
- -> { where(role: role.to_s) },
26
- has_many_options(role)
27
- end
28
-
29
- def define_role_based_inflection_5(role)
30
- has_many "#{role.to_s}_comments".to_sym,
31
- -> { where(role: role.to_s) },
32
- has_many_options(role)
33
- end
34
-
35
18
  def define_role_based_inflection_6(role)
36
19
  if RUBY_VERSION.first >= '3'
37
20
  has_many "#{role.to_s}_comments".to_sym,
@@ -56,6 +39,18 @@ module Juixe
56
39
  end
57
40
  end
58
41
 
42
+ def define_role_based_inflection_8(role)
43
+ if RUBY_VERSION.first >= '3'
44
+ has_many "#{role.to_s}_comments".to_sym,
45
+ -> { where(role: role.to_s) },
46
+ **has_many_options(role)
47
+ else
48
+ has_many "#{role.to_s}_comments".to_sym,
49
+ -> { where(role: role.to_s) },
50
+ has_many_options(role)
51
+ end
52
+ end
53
+
59
54
 
60
55
  def has_many_options(role)
61
56
  {:class_name => "Comment",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: digitalmoksha-acts_as_commentable
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 8.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cosmin Radoi, Jack Dempsey, Xelipe, Chris Eppstein
@@ -9,15 +9,15 @@ authors:
9
9
  autorequire: acts_as_commentable
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-09-23 00:00:00.000000000 Z
12
+ date: 1980-01-02 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Plugin/gem that provides comment functionality
15
15
  email: unknown@juixe.com
16
16
  executables: []
17
17
  extensions: []
18
18
  extra_rdoc_files:
19
- - README.rdoc
20
19
  - MIT-LICENSE
20
+ - README.rdoc
21
21
  files:
22
22
  - MIT-LICENSE
23
23
  - README.rdoc
@@ -34,7 +34,6 @@ homepage: https://github.com/digitalmoksha/acts_as_commentable
34
34
  licenses:
35
35
  - MIT
36
36
  metadata: {}
37
- post_install_message:
38
37
  rdoc_options: []
39
38
  require_paths:
40
39
  - lib
@@ -49,8 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
48
  - !ruby/object:Gem::Version
50
49
  version: '0'
51
50
  requirements: []
52
- rubygems_version: 3.4.10
53
- signing_key:
51
+ rubygems_version: 4.0.11
54
52
  specification_version: 3
55
53
  summary: Plugin/gem that provides comment functionality
56
54
  test_files: []