mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-23 04:56:22 +00:00
fix: reusar belongs to
This commit is contained in:
parent
b09d051de1
commit
ce7c7ffd96
1 changed files with 2 additions and 18 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue