also render null values in formatables

pull/2554/head
Jan Sandbrink 10 years ago
parent c37579def9
commit b38eb09c5b
  1. 9
      lib/api/decorators/formatable.rb

@ -42,14 +42,17 @@ module API
property :format, property :format,
exec_context: :decorator, exec_context: :decorator,
getter: -> (*) { @format == '' ? 'plain' : @format }, getter: -> (*) { @format == '' ? 'plain' : @format },
writable: false writable: false,
render_nil: true
property :raw, property :raw,
exec_context: :decorator, exec_context: :decorator,
getter: -> (*) { represented } getter: -> (*) { represented },
render_nil: true
property :html, property :html,
exec_context: :decorator, exec_context: :decorator,
getter: -> (*) { to_html }, getter: -> (*) { to_html },
writable: false writable: false,
render_nil: true
def to_html def to_html
format_text(represented, format: @format, object: @object) format_text(represented, format: @format, object: @object)

Loading…
Cancel
Save