Skip to content
GitLab
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
51eeffa2
Verified
Commit
51eeffa2
authored
Oct 04, 2018
by
Kaspar Vollenweider
👻
Browse files
add relation between semester_process and hours
parent
438fe100
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/models/hour.rb
View file @
51eeffa2
...
...
@@ -12,6 +12,8 @@ class Hour < ApplicationRecord
belongs_to
:billing_expense
,
->
{
with_deleted
},
optional:
true
,
inverse_of:
'hours'
belongs_to
:certificate
,
optional:
true
belongs_to
:semester_process_volunteer
,
optional:
true
validates
:hours
,
presence:
true
,
numericality:
{
greater_than:
0
}
validates
:meeting_date
,
presence:
true
validates
:hourable
,
presence:
true
...
...
app/models/semester_process_volunteer.rb
View file @
51eeffa2
...
...
@@ -9,4 +9,5 @@ class SemesterProcessVolunteer < ApplicationRecord
inverse_of:
'semester_processes'
,
optional:
true
has_many
:semester_feedbacks
,
dependent: :destroy
has_many
:hours
,
dependent: :nullify
end
db/migrate/20181004163636_add_relation_between_semester_process_and_hour.rb
0 → 100644
View file @
51eeffa2
class
AddRelationBetweenSemesterProcessAndHour
<
ActiveRecord
::
Migration
[
5.1
]
def
change
change_table
:hours
do
|
t
|
t
.
references
:semester_process_volunteer
,
foreign_key:
true
end
end
end
db/schema.rb
View file @
51eeffa2
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201810041
44449
)
do
ActiveRecord
::
Schema
.
define
(
version:
201810041
63636
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -489,6 +489,7 @@ ActiveRecord::Schema.define(version: 20181004144449) do
t
.
string
"hourable_type"
t
.
bigint
"hourable_id"
t
.
bigint
"reviewer_id"
t
.
bigint
"semester_process_volunteer_id"
t
.
index
[
"billing_expense_id"
],
name:
"index_hours_on_billing_expense_id"
t
.
index
[
"deleted_at"
],
name:
"index_hours_on_deleted_at"
t
.
index
[
"hourable_type"
,
"hourable_id"
],
name:
"index_hours_on_hourable_type_and_hourable_id"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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