acts-as-joinable 0.1.7.2 → 0.1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/acts_as_joinable/core.rb +7 -1
- metadata +3 -3
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ require 'rake/gempackagetask'
|
|
5
5
|
spec = Gem::Specification.new do |s|
|
6
6
|
s.name = "acts-as-joinable"
|
7
7
|
s.authors = ["Lance Pollard"]
|
8
|
-
s.version = "0.1.7.
|
8
|
+
s.version = "0.1.7.3"
|
9
9
|
s.summary = "ActsAsJoinable: DRYing up Many-to-Many Relationships in ActiveRecord"
|
10
10
|
s.homepage = "http://github.com/viatropos/acts-as-joinable"
|
11
11
|
s.email = "lancejpollard@gmail.com"
|
@@ -50,6 +50,9 @@ module ActsAsJoinable
|
|
50
50
|
relationships = [opts[:as] || :parent].flatten.map(&:to_sym)
|
51
51
|
end
|
52
52
|
|
53
|
+
before_add = opts[:before_add]
|
54
|
+
after_add = opts[:after_add]
|
55
|
+
|
53
56
|
opts[:class_name] ||= opts[:source].to_s.camelize if opts[:source]
|
54
57
|
|
55
58
|
association_type = opts[:limit] == 1 ? :has_one : :has_many
|
@@ -107,6 +110,9 @@ module ActsAsJoinable
|
|
107
110
|
:conditions => sql
|
108
111
|
}
|
109
112
|
|
113
|
+
options[:before_add] = before_add if before_add
|
114
|
+
options[:after_add] = after_add if after_add
|
115
|
+
|
110
116
|
# relationships == [:parent, :child]
|
111
117
|
relationships.each do |relationship|
|
112
118
|
# Post.joins :tags, :as => :parent
|
@@ -143,7 +149,7 @@ module ActsAsJoinable
|
|
143
149
|
}
|
144
150
|
|
145
151
|
if association_type == :has_one
|
146
|
-
options.delete(:after_add)
|
152
|
+
#options.delete(:after_add)
|
147
153
|
options.delete(:uniq)
|
148
154
|
else
|
149
155
|
through_options[:uniq] = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts-as-joinable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 93
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
9
|
- 7
|
10
|
-
-
|
11
|
-
version: 0.1.7.
|
10
|
+
- 3
|
11
|
+
version: 0.1.7.3
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Lance Pollard
|