attribution 0.5.0 → 0.5.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.
- data/attribution.gemspec +1 -1
- data/lib/attribution/version.rb +1 -1
- data/lib/attribution.rb +1 -1
- data/test/attribution_test.rb +4 -0
- metadata +2 -2
data/attribution.gemspec
CHANGED
data/lib/attribution/version.rb
CHANGED
data/lib/attribution.rb
CHANGED
@@ -233,7 +233,7 @@ module Attribution
|
|
233
233
|
raise ArgumentError.new("Association #{association_name} in #{self.class} is invalid because #{association_name.to_s.classify} does not exist")
|
234
234
|
end
|
235
235
|
|
236
|
-
objs = Array(arg).map do |obj|
|
236
|
+
objs = (arg.is_a?(Hash) ? arg.values : Array(arg)).map do |obj|
|
237
237
|
o = association_class.cast(obj)
|
238
238
|
o.send("#{self.class.name.underscore}=", self)
|
239
239
|
o.send("#{self.class.name.underscore}_id=", id)
|
data/test/attribution_test.rb
CHANGED
@@ -205,4 +205,8 @@ class AttributionTest < Test::Unit::TestCase
|
|
205
205
|
assert_equal BigDecimal.new("50"), book.price
|
206
206
|
assert_equal nil, book.id
|
207
207
|
end
|
208
|
+
|
209
|
+
def test_has_many_setter_with_hash
|
210
|
+
assert_equal(["test"], Book.new("chapters" => { "0" => { "title" => "test" }}).chapters.map(&:title))
|
211
|
+
end
|
208
212
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attribution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|