diff --git a/app/models/donation_feature.rb b/app/models/donation_feature.rb index 0d650aa5..b1e9c67c 100644 --- a/app/models/donation_feature.rb +++ b/app/models/donation_feature.rb @@ -7,7 +7,7 @@ class DonationFeature < ActiveRecord::Base delegate :donor_name, to: :donation def as_json(options={}) - {donor_name: donor_name, outfit_image_url: outfit.image.medium.url} + {donor_name: donor_name, outfit_image_url: outfit_image_url} end def outfit_url=(outfit_url) @@ -17,4 +17,8 @@ class DonationFeature < ActiveRecord::Base def outfit_id_present? outfit_id.present? end + + def outfit_image_url + outfit && outfit.image ? outfit.image.medium.url : nil + end end