Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
aoz-003
Commits
c9ad883b
Verified
Commit
c9ad883b
authored
Feb 01, 2018
by
Kaspar Vollenweider
👻
Browse files
Rubocop inverse_of happyness
parent
45617c16
Pipeline
#13858
failed with stage
in 24 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/models/group_offer.rb
View file @
c9ad883b
...
...
@@ -10,11 +10,14 @@ class GroupOffer < ApplicationRecord
belongs_to
:department
,
optional:
true
belongs_to
:group_offer_category
belongs_to
:creator
,
->
{
with_deleted
},
class_name:
'User'
,
optional:
true
belongs_to
:creator
,
->
{
with_deleted
},
class_name:
'User'
,
optional:
true
,
inverse_of:
'group_offers'
# termination record relations
belongs_to
:period_end_set_by
,
->
{
with_deleted
},
class_name:
'User'
,
optional:
true
belongs_to
:termination_verified_by
,
->
{
with_deleted
},
class_name:
'User'
,
optional:
true
belongs_to
:period_end_set_by
,
->
{
with_deleted
},
class_name:
'User'
,
optional:
true
,
inverse_of:
'group_offer_period_ends_set'
belongs_to
:termination_verified_by
,
->
{
with_deleted
},
class_name:
'User'
,
optional:
true
,
inverse_of:
'group_offer_terminations_verified'
has_many
:group_assignments
,
dependent: :destroy
accepts_nested_attributes_for
:group_assignments
,
allow_destroy:
true
...
...
@@ -23,9 +26,10 @@ class GroupOffer < ApplicationRecord
has_many
:volunteers
,
through: :group_assignments
has_many
:volunteer_logs
,
through: :group_assignment_logs
has_many
:hours
,
as: :hourable
,
dependent: :destroy
has_many
:feedbacks
,
as: :feedbackable
,
dependent: :destroy
has_many
:trial_feedbacks
,
as: :trial_feedbackable
,
dependent: :destroy
has_many
:hours
,
as: :hourable
,
dependent: :destroy
,
inverse_of: :hourable
has_many
:feedbacks
,
as: :feedbackable
,
dependent: :destroy
,
inverse_of: :feedbackable
has_many
:trial_feedbacks
,
as: :trial_feedbackable
,
inverse_of: :trial_feedbackable
,
dependent: :destroy
has_many
:volunteer_contacts
,
through: :volunteers
,
source: :contact
...
...
@@ -33,9 +37,9 @@ class GroupOffer < ApplicationRecord
validates
:necessary_volunteers
,
numericality:
{
greater_than:
0
},
allow_nil:
true
validates
:period_end
,
absence:
{
message:
lambda
{
|
object
,
_
|
'Dieses Gruppenangebot kann noch nicht beendet werden, da es noch '
\
"
#{
object
.
group_assignments
.
running
.
count
}
laufende Gruppeneinsätze hat."
}
'Dieses Gruppenangebot kann noch nicht beendet werden, da es noch '
\
"
#{
object
.
group_assignments
.
running
.
count
}
laufende Gruppeneinsätze hat."
}
},
if: :running_assignments?
scope
:active
,
(
->
{
where
(
active:
true
)
})
...
...
app/models/user.rb
View file @
c9ad883b
...
...
@@ -14,31 +14,40 @@ class User < ApplicationRecord
has_many
:certificates
has_many
:clients
has_many
:volunteers
,
inverse_of:
'registrar'
,
foreign_key:
'registrar_id'
has_many
:involved_authorities
,
class_name:
'Client'
has_many
:involved_authorities
,
class_name:
'Client'
,
foreign_key:
'involved_authority_id'
,
inverse_of:
'involved_authority'
has_many
:journals
has_many
:assignments
,
inverse_of:
'creator'
,
foreign_key:
'creator_id'
has_many
:feedbacks
,
inverse_of:
'author'
,
foreign_key:
'author_id'
has_many
:billing_expenses
has_many
:group_offers
,
inverse_of:
'creator'
,
foreign_key:
'creator_id'
has_many
:reminder_mailings
,
inverse_of:
'creator'
,
foreign_key:
'creator_id'
has_many
:reviewed_feedbacks
,
class_name:
'Feedback'
,
foreign_key:
'reviewer_id'
has_many
:reviewed_trial_feedbacks
,
class_name:
'TrialFeedback'
,
foreign_key:
'reviewer_id'
has_many
:reviewed_hours
,
class_name:
'Hour'
,
foreign_key:
'reviewer_id'
has_many
:reviewed_feedbacks
,
class_name:
'Feedback'
,
foreign_key:
'reviewer_id'
,
inverse_of:
'reviewer'
has_many
:reviewed_trial_feedbacks
,
class_name:
'TrialFeedback'
,
foreign_key:
'reviewer_id'
,
inverse_of:
'reviewer'
has_many
:reviewed_hours
,
class_name:
'Hour'
,
foreign_key:
'reviewer_id'
,
inverse_of:
'reviewer'
# Assignment termination relations
has_many
:assignment_period_ends_set
,
class_name:
'Assignment'
,
foreign_key:
'period_end_set_by'
has_many
:assignment_period_ends_set
,
class_name:
'Assignment'
,
foreign_key:
'period_end_set_by_id'
,
inverse_of:
'period_end_set_by'
has_many
:assignment_terminations_submitted
,
class_name:
'Assignment'
,
foreign_key:
'termination_submitted_by'
foreign_key:
'termination_submitted_by_id'
,
inverse_of:
'termination_submitted_by'
has_many
:assignment_terminations_verified
,
class_name:
'Assignment'
,
foreign_key:
'termination_verified_by'
foreign_key:
'termination_verified_by_id'
,
inverse_of:
'termination_verified_by'
# GroupAssignment termination relations
has_many
:group_assignment_period_ends_set
,
class_name:
'GroupAssignment'
,
foreign_key:
'period_end_set_by'
foreign_key:
'period_end_set_by_id'
,
inverse_of:
'period_end_set_by'
has_many
:group_assignment_terminations_submitted
,
class_name:
'GroupAssignment'
,
foreign_key:
'termination_submitted_by'
foreign_key:
'termination_submitted_by_id'
,
inverse_of:
'termination_submitted_by'
has_many
:group_assignment_terminations_verified
,
class_name:
'GroupAssignment'
,
foreign_key:
'termination_verified_by'
foreign_key:
'termination_verified_by'
,
inverse_of:
'termination_verified_by'
has_many
:group_offer_period_ends_set
,
class_name:
'GroupOffer'
,
foreign_key:
'period_end_set_by_id'
,
inverse_of:
'period_end_set_by'
has_many
:group_offer_terminations_verified
,
class_name:
'GroupOffer'
,
foreign_key:
'termination_verified_by_id'
,
inverse_of:
'termination_verified_by'
# Mailing process done relation
has_many
:process_submitted_by
,
class_name:
'ReminderMailingVolunteer'
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment