From: Michal Fojtik <[email protected]>
Signed-off-by: Michal fojtik <[email protected]> --- server/lib/deltacloud/models/base_model.rb | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/server/lib/deltacloud/models/base_model.rb b/server/lib/deltacloud/models/base_model.rb index f287f3e..ae08f12 100644 --- a/server/lib/deltacloud/models/base_model.rb +++ b/server/lib/deltacloud/models/base_model.rb @@ -46,7 +46,11 @@ class BaseModel def to_hash out = {} - self.attributes.each { |attribute| out.merge!({ attribute => self.send(:"#{attribute}") } ) } + self.attributes.each do |attribute| + if self.send(:"#{attribute}") + out.merge!({ attribute => self.send(:"#{attribute}") } ) + end + end out end -- 1.7.4.1
