5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-08 23:45:44 +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
class MetadataHasOne < MetadataBelongsTo
def had_one
return default_value if value_was.blank?
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
alias has_one belongs_to
alias had_one belonged_to
def save
# XXX: DRY
@ -38,8 +26,4 @@ class MetadataHasOne < MetadataBelongsTo
def related_methods
@related_methods ||= %i[has_one had_one].freeze
end
def indexable_values
has_one&.title&.value
end
end