acts_as_commentable2 7.1.0.1 → 7.2.0.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cba4e2158759d8b64431532ea6549f553098890ee51d31d10c6395699c34d3b4
4
- data.tar.gz: b0422fd7970df076c0fdf8435c3f0eb331945d17b915261ba5db31a751df894f
3
+ metadata.gz: 1025e16458f3cbd4cf626aa47ac5bc333d91d171af2bc7927cede9a77a4b6635
4
+ data.tar.gz: 35b6beb57cdbce25fe90c5224c5c107cd81290e34ca21269b51b6ce071a44611
5
5
  SHA512:
6
- metadata.gz: b6a93a595c46937d7f3fd1dc3fd8e50e857bdcd34382eb0ae3c034dd64c589b0bcdbd8eae3e2545648c18fef4f77947245f5925aa32374f6578ed91a1c7a108f
7
- data.tar.gz: e7dd1cc9f91a6ed2b4031f4be45a7b5d50941443f98df5e73dda31def652051f426592e1bc2a4b7336c492e4d00eeb0100e2f28cd7eb768444719dc5eec48fe6
6
+ metadata.gz: 673c8bd078e3446afe30687c0215f6d4bde83966b0a8c39538c1677977cc8de26c941b5c7bb6e54d88d4639a0ca6e3ecfd5df8d97134815c378a709ec5e6c5fc
7
+ data.tar.gz: 2a432e27973ec295786736f4049ad4352b7f07ff4e943652e584b04d46e4212830d4ff2b5eb6a5237e3523f2bcfcf6979b2bf7d233ef6dcb31b0aba5eec202fa
data/README.rdoc CHANGED
@@ -13,6 +13,7 @@ Add the following line to your Gemfile
13
13
 
14
14
  gem 'acts_as_commentable', git: 'git@github.com:fatfreecrm/acts_as_commentable.git'
15
15
 
16
+ Choose the appropriate tag for your rails version.
16
17
 
17
18
  == Generator
18
19
 
@@ -29,7 +29,8 @@ module ActsAsCommentable
29
29
  # Helper class method to look up all comments for
30
30
  # commentable class name and commentable id.
31
31
  def find_comments_for_commentable(commentable_str, commentable_id, role = 'comments')
32
- where(['commentable_type = ? and commentable_id = ? and role = ?', commentable_str, commentable_id, role]).order('created_at DESC')
32
+ where(['commentable_type = ? and commentable_id = ? and role = ?', commentable_str, commentable_id,
33
+ role]).order('created_at DESC')
33
34
  end
34
35
 
35
36
  # Helper class method to look up a commentable object
@@ -2,8 +2,8 @@ require 'active_record'
2
2
 
3
3
  # ActsAsCommentable
4
4
  module Juixe
5
- module Acts #:nodoc:
6
- module Commentable #:nodoc:
5
+ module Acts # :nodoc:
6
+ module Commentable # :nodoc:
7
7
  def self.included(base)
8
8
  base.extend ClassMethods
9
9
  end
@@ -12,9 +12,9 @@ module Juixe
12
12
  private
13
13
 
14
14
  def define_role_based_inflection(role)
15
- return if method_defined?("#{role}_comments".to_sym)
15
+ return if method_defined?(:"#{role}_comments")
16
16
 
17
- has_many "#{role}_comments".to_sym,
17
+ has_many :"#{role}_comments",
18
18
  -> { where(role: role.to_s) },
19
19
  **has_many_options(role)
20
20
  end
@@ -44,13 +44,13 @@ module Juixe
44
44
  class_attribute :comment_types
45
45
  self.comment_types = (comment_roles.blank? ? [:comments] : comment_roles)
46
46
 
47
- if !comment_roles.blank?
47
+ if comment_roles.blank?
48
+ has_many :comments, as: :commentable, dependent: :destroy, **join_options
49
+ else
48
50
  comment_roles.each do |role|
49
51
  define_role_based_inflection(role)
50
52
  end
51
- has_many :all_comments, **{ as: :commentable, dependent: :destroy, class_name: 'Comment' }.merge(join_options)
52
- else
53
- has_many :comments, **{ as: :commentable, dependent: :destroy }.merge(join_options)
53
+ has_many :all_comments, as: :commentable, dependent: :destroy, class_name: 'Comment', **join_options
54
54
  end
55
55
 
56
56
  comment_types.each do |role|
@@ -64,7 +64,9 @@ module Juixe
64
64
 
65
65
  def self.find_#{method_name}_by_user(user)
66
66
  commentable = self.base_class.name
67
- Comment.where(["user_id = ? and commentable_type = ? and role = ?", user.id, commentable, "#{role}"]).order("created_at DESC")
67
+ Comment.where([
68
+ "user_id = ? and commentable_type = ? and role = ?", user.id, commentable, "#{role}"
69
+ ]).order("created_at DESC")
68
70
  end
69
71
 
70
72
  def #{method_name}_ordered_by_submitted
@@ -75,7 +77,7 @@ module Juixe
75
77
  comment.role = "#{role}"
76
78
  #{method_name} << comment
77
79
  end
78
- }
80
+ }, __FILE__, __LINE__ - 21
79
81
  end
80
82
  end
81
83
  end
@@ -83,4 +85,4 @@ module Juixe
83
85
  end
84
86
  end
85
87
 
86
- ActiveRecord::Base.send(:include, Juixe::Acts::Commentable)
88
+ ActiveRecord::Base.include Juixe::Acts::Commentable
@@ -4,7 +4,7 @@ class CommentGenerator < Rails::Generators::Base
4
4
  include Rails::Generators::Migration
5
5
 
6
6
  def self.source_root
7
- @_acts_as_commentable_source_root ||= File.expand_path('templates', __dir__)
7
+ @source_root ||= File.expand_path('templates', __dir__)
8
8
  end
9
9
 
10
10
  def self.next_migration_number(_path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_commentable2
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.0.1
4
+ version: 7.2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cosmin Radoi, Jack Dempsey, Xelipe, Chris Eppstein
@@ -16,16 +16,16 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 7.1.0
19
+ version: 7.2.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 7.1.0
26
+ version: 7.2.0
27
27
  description: Plugin/gem that provides comment functionality
28
- email: unknown@juixe.com
28
+ email: daniel.oconnor@gmail.com
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files:
@@ -46,7 +46,8 @@ files:
46
46
  homepage: http://www.juixe.com/techknow/index.php/2006/06/18/acts-as-commentable-plugin/
47
47
  licenses:
48
48
  - MIT
49
- metadata: {}
49
+ metadata:
50
+ rubygems_mfa_required: 'true'
50
51
  rdoc_options: []
51
52
  require_paths:
52
53
  - lib
@@ -54,7 +55,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
54
55
  requirements:
55
56
  - - ">="
56
57
  - !ruby/object:Gem::Version
57
- version: '0'
58
+ version: 3.1.0
58
59
  required_rubygems_version: !ruby/object:Gem::Requirement
59
60
  requirements:
60
61
  - - ">="
@@ -62,6 +63,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
63
  version: '0'
63
64
  requirements: []
64
65
  rubygems_version: 3.6.2
65
- specification_version: 3
66
+ specification_version: 4
66
67
  summary: Plugin/gem that provides comment functionality
67
68
  test_files: []