From 4ae6fe797728f1b3c8ec135b485602ceb28151e2 Mon Sep 17 00:00:00 2001 From: Mario Visic Date: Thu, 15 Dec 2011 22:11:54 +0800 Subject: [PATCH] False values for custom fields are now correctly exported. Fixes #250. --- lib/locomotive/export.rb | 2 +- spec/lib/locomotive/export_spec.rb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/locomotive/export.rb b/lib/locomotive/export.rb index 602e2440..78aab45f 100644 --- a/lib/locomotive/export.rb +++ b/lib/locomotive/export.rb @@ -305,7 +305,7 @@ module Locomotive content.send(field.safe_alias.to_sym) end) - hash[field._alias] = value unless value.blank? + hash[field._alias] = value if value.present? || value == false # False values should be preserved in the export end data << { content.highlighted_field_value => hash } diff --git a/spec/lib/locomotive/export_spec.rb b/spec/lib/locomotive/export_spec.rb index 6faa2b63..da169829 100644 --- a/spec/lib/locomotive/export_spec.rb +++ b/spec/lib/locomotive/export_spec.rb @@ -25,7 +25,8 @@ describe Locomotive::Export do end it 'deals with real booleans' do - @project_data.first.values.first['active'].should be_true + @project_data.first.values.first['active'].should === true + @project_data.last.values.first['active'].should === false end it 'stores the list of highlighted values in a has_many relationship' do