1
0
Fork 0

Rename association RelationStatus#transitions to #outgoing_transitions

This commit is contained in:
Alex Kotov 2019-10-02 02:55:03 +05:00
parent 38d244198f
commit 2a2ad28579
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
7 changed files with 9 additions and 9 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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 %>

View file

@ -115,7 +115,7 @@ en:
id: ID
codename: Codename
name: Name
transitions: Transitions
outgoing_transitions: Outgoing transitions
relationship:
id: ID
from_date: From date

View file

@ -115,7 +115,7 @@ ru:
id: ID
codename: Кодовое имя
name: Название
transitions: Переходы
outgoing_transitions: Исходящие переходы
relationship:
id: ID
from_date: Дата начала

View file

@ -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)

View file

@ -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