Rename association RelationStatus#transitions to #outgoing_transitions
This commit is contained in:
parent
38d244198f
commit
2a2ad28579
7 changed files with 9 additions and 9 deletions
|
@ -5,7 +5,7 @@ class RelationStatus < ApplicationRecord
|
|||
# Associations #
|
||||
################
|
||||
|
||||
has_many :transitions,
|
||||
has_many :outgoing_transitions,
|
||||
class_name: 'RelationTransition',
|
||||
inverse_of: :from_status,
|
||||
foreign_key: :from_status_id,
|
||||
|
|
|
@ -7,7 +7,7 @@ class RelationTransition < ApplicationRecord
|
|||
|
||||
belongs_to :from_status,
|
||||
class_name: 'RelationStatus',
|
||||
inverse_of: :transitions,
|
||||
inverse_of: :outgoing_transitions,
|
||||
optional: true
|
||||
|
||||
belongs_to :to_status,
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<h4><%= RelationStatus.human_attribute_name :transitions %></h5>
|
||||
<h4><%= RelationStatus.human_attribute_name :outgoing_transitions %></h5>
|
||||
|
||||
<ul class="list-group mt-3">
|
||||
<% @relation_status.transitions.each do |relation_transition| %>
|
||||
<% @relation_status.outgoing_transitions.each do |relation_transition| %>
|
||||
<li class="list-group-item">
|
||||
<div class="d-flex justify-content-between">
|
||||
<%= relation_transition.name %>
|
||||
|
|
|
@ -115,7 +115,7 @@ en:
|
|||
id: ID
|
||||
codename: Codename
|
||||
name: Name
|
||||
transitions: Transitions
|
||||
outgoing_transitions: Outgoing transitions
|
||||
relationship:
|
||||
id: ID
|
||||
from_date: From date
|
||||
|
|
|
@ -115,7 +115,7 @@ ru:
|
|||
id: ID
|
||||
codename: Кодовое имя
|
||||
name: Название
|
||||
transitions: Переходы
|
||||
outgoing_transitions: Исходящие переходы
|
||||
relationship:
|
||||
id: ID
|
||||
from_date: Дата начала
|
||||
|
|
|
@ -11,10 +11,10 @@ RSpec.describe RelationStatus do
|
|||
end
|
||||
end
|
||||
|
||||
describe '#transitions' do
|
||||
describe '#outgoing_transitions' do
|
||||
it do
|
||||
is_expected.to \
|
||||
have_many(:transitions)
|
||||
have_many(:outgoing_transitions)
|
||||
.class_name('RelationTransition')
|
||||
.inverse_of(:from_status)
|
||||
.dependent(:restrict_with_exception)
|
||||
|
|
|
@ -10,7 +10,7 @@ RSpec.describe RelationTransition do
|
|||
is_expected.to \
|
||||
belong_to(:from_status)
|
||||
.class_name('RelationStatus')
|
||||
.inverse_of(:transitions)
|
||||
.inverse_of(:outgoing_transitions)
|
||||
.optional
|
||||
end
|
||||
|
||||
|
|
Reference in a new issue