lib/transcriber/resource/key/association.rb in transcriber-0.0.10 vs lib/transcriber/resource/key/association.rb in transcriber-0.0.11
- old
+ new
@@ -28,8 +28,13 @@
def from_hash(attrs)
return nil if attrs.nil? or attrs.empty?
one? ? resource_class.new(attrs)
: Array(attrs).map {|item| resource_class.new(item)}
end
+
+ def to_input(value)
+ return nil if value.nil?
+ one? ? value.to_input : value.map(&:to_input)
+ end
end
end
end