1
0
Fork 0
forked from OpenNeo/impress

Mark some more relationships as optional

I noticed this was stopping changing your default list visibility bc contact neopets connection can't be empty, so I fixed that!

And then I just decided to scroll through every `belongs_to` relationship and add optional to the ones that jumped out at me lol
This commit is contained in:
Emi Matchu 2023-08-06 16:00:33 -07:00
parent 07d2519e40
commit 621a0bc211
3 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,7 @@ class Donation < ApplicationRecord
FEATURE_COST = 500 # in cents = $5.00
belongs_to :campaign
belongs_to :user
belongs_to :user, optional: true
has_many :features, class_name: 'DonationFeature'
def to_param

View file

@ -1,6 +1,6 @@
class DonationFeature < ApplicationRecord
belongs_to :donation
belongs_to :outfit
belongs_to :outfit, optional: true
validates :outfit, presence: true, if: :outfit_id_present?

View file

@ -18,7 +18,7 @@ class User < ApplicationRecord
has_many :wanted_items, -> { where(ClosetHanger.arel_table[:owned].eq(false)) },
through: :closet_hangers, source: :item
belongs_to :contact_neopets_connection, class_name: 'NeopetsConnection'
belongs_to :contact_neopets_connection, class_name: 'NeopetsConnection', optional: true
scope :top_contributors, -> { order('points DESC').where('points > 0') }