lib/whyvalidationssuckin96/validation_collection.rb in whyvalidationssuckin96-1.6.2 vs lib/whyvalidationssuckin96/validation_collection.rb in whyvalidationssuckin96-1.6.3
- old
+ new
@@ -1,12 +1,16 @@
module WhyValidationsSuckIn96
class ValidationCollection < Array
def to_json(options={})
+ to_hash.to_json(options)
+ end
+
+ def to_hash
inject({}) do |acc,validation|
acc[validation.attribute] = validation.options
acc
- end.to_json(options)
+ end
end
def select(&block)
self.class.new super
end