mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-29 18:26:22 +00:00
232cda1379
(cherry picked from commit 4cf57a441a
)
23 lines
424 B
Ruby
23 lines
424 B
Ruby
# frozen_string_literal: true
|
|
|
|
module Metadata
|
|
module InverseConcern
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
# Hay una relación inversa?
|
|
#
|
|
# @return [Boolean]
|
|
def inverse?
|
|
inverse.present?
|
|
end
|
|
|
|
# La relación inversa
|
|
#
|
|
# @return [Nil,Symbol]
|
|
def inverse
|
|
@inverse ||= layout.metadata.dig(name, 'inverse')&.to_sym
|
|
end
|
|
end
|
|
end
|
|
end
|