make_commentable 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,4 @@
|
|
1
1
|
require 'version'
|
2
|
-
require 'active_record'
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
def mark_as_commentable(options={})
|
7
|
-
has_many :comments, {:as => :commentable, :dependent => :destroy}.merge(options)
|
8
|
-
accepts_nested_attributes_for :comments, :allow_destroy => true
|
9
|
-
|
10
|
-
include Commentable::InstanceMethods
|
11
|
-
extend Commentable::SingletonMethods
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
#This module contains class methods
|
16
|
-
module SingletonMethods
|
17
|
-
end
|
18
|
-
|
19
|
-
# This module contains instance methods
|
20
|
-
module InstanceMethods
|
21
|
-
end
|
22
|
-
end
|
23
|
-
ActiveRecord::Base.send(:include, Commentable)
|
3
|
+
require 'commentable_methods'
|
4
|
+
require 'comment_methods'
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'version'
|
2
|
+
require 'active_record'
|
3
|
+
|
4
|
+
module Commentable
|
5
|
+
module ClassMethods
|
6
|
+
def mark_as_commentable(options={})
|
7
|
+
has_many :comments, {:as => :commentable, :dependent => :destroy}.merge(options)
|
8
|
+
accepts_nested_attributes_for :comments, :allow_destroy => true
|
9
|
+
|
10
|
+
include Commentable::InstanceMethods
|
11
|
+
extend Commentable::SingletonMethods
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
#This module contains class methods
|
16
|
+
module SingletonMethods
|
17
|
+
end
|
18
|
+
|
19
|
+
# This module contains instance methods
|
20
|
+
module InstanceMethods
|
21
|
+
end
|
22
|
+
end
|
23
|
+
ActiveRecord::Base.send(:include, Commentable)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: make_commentable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -57,6 +57,7 @@ files:
|
|
57
57
|
- commentable/lib/generators/comment/comment_generator.rb
|
58
58
|
- commentable/lib/commentable/comment_methods.rb
|
59
59
|
- commentable/lib/commentable/version.rb
|
60
|
+
- commentable/lib/commentable/commentable_methods.rb
|
60
61
|
- commentable/lib/commentable/commentable.rb
|
61
62
|
- commentable/README.md
|
62
63
|
- commentable/LICENSE
|