has_options 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/has_options.gemspec +1 -1
- data/lib/has_options/has_options.rb +10 -0
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.3
|
data/has_options.gemspec
CHANGED
@@ -33,6 +33,16 @@ module HasOptionsHash
|
|
33
33
|
|
34
34
|
option_hash
|
35
35
|
end
|
36
|
+
|
37
|
+
define_method "#{association_name}_hash_interned" do
|
38
|
+
result = #{association_name}_hash
|
39
|
+
result.symbolize_keys!
|
40
|
+
|
41
|
+
result.each_pair do |k,v|
|
42
|
+
result[k] = nil if v.length == 0
|
43
|
+
result[k] = v.first if v.length == 1
|
44
|
+
end
|
45
|
+
end
|
36
46
|
|
37
47
|
define_method "set_#{singular_association}!" do |name, *values|
|
38
48
|
name = name.to_s
|