5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 05:06:22 +00:00

fix: reusar belongs to

This commit is contained in:
f 2023-04-08 17:45:02 -03:00
parent b09d051de1
commit ce7c7ffd96

View file

@ -1,20 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
class MetadataHasOne < MetadataBelongsTo class MetadataHasOne < MetadataBelongsTo
def had_one alias has_one belongs_to
return default_value if value_was.blank? alias had_one belonged_to
posts.find(value, uuid: true)
end
def has_one
return default_value if value.blank?
posts.find(value, uuid: true)
end
def belonged_to; end
def belongs_to; end
def save def save
# XXX: DRY # XXX: DRY
@ -38,8 +26,4 @@ class MetadataHasOne < MetadataBelongsTo
def related_methods def related_methods
@related_methods ||= %i[has_one had_one].freeze @related_methods ||= %i[has_one had_one].freeze
end end
def indexable_values
has_one&.title&.value
end
end end