lib/restful/serializers/base.rb in purzelrakete-restful-0.2.1 vs lib/restful/serializers/base.rb in purzelrakete-restful-0.2.2
- old
+ new
@@ -26,9 +26,23 @@
def self.serializer_name(key)
self.serializers ||= {}
self.serializers[key] = self
end
+ def formatted_value(value)
+ return nil if value.value.blank? && value.extended_type != :false_class
+ case value.extended_type
+ when :datetime
+ value.value.xmlschema
+ when :time
+ value.value.xmlschema
+ when :date
+ value.value.to_s(:db)
+ else
+ value.value
+ end
+ end
+
protected
def transform_link_name(name)
name.to_s.gsub /_id$/, "-restful-url"
end
\ No newline at end of file