File tree Expand file tree Collapse file tree 2 files changed +9
-11
lines changed
Expand file tree Collapse file tree 2 files changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ class OdsaUserTimeTrackingController < ApplicationController
88 # POST /odsa_user_time_tracking/create
99 def create
1010 failed_to_save = false
11- errors = [ ]
11+ error_msgs = [ ]
1212 # puts params[:modulesTracking]
1313 params [ :modulesTracking ] . each_pair do |key , event |
1414 # puts event
@@ -31,9 +31,7 @@ def create
3131 total_time : event [ :totalTime ] ,
3232 sections_time : event [ :sectionsTime ]
3333 )
34- if @user_time_tracking . save
35- failed_to_save = false
36- else
34+ if !@user_time_tracking . save
3735 failed_to_save = true
3836 error_msgs << @user_time_tracking . errors . full_messages
3937 end
Original file line number Diff line number Diff line change 3434class OdsaUserTimeTracking < ApplicationRecord
3535 #~ Relationships ............................................................
3636 belongs_to :user
37- belongs_to :inst_book
38- belongs_to :inst_book_section_exercise
39- belongs_to :inst_course_offering_exercise
40- belongs_to :inst_module
41- belongs_to :inst_chapter
42- belongs_to :inst_module_version
43- belongs_to :inst_module_section_exercise
37+ belongs_to :inst_book , optional : true
38+ belongs_to :inst_book_section_exercise , optional : true
39+ belongs_to :inst_course_offering_exercise , optional : true
40+ belongs_to :inst_module , optional : true
41+ belongs_to :inst_chapter , optional : true
42+ belongs_to :inst_module_version , optional : true
43+ belongs_to :inst_module_section_exercise , optional : true
4444
4545 #~ Validation ...............................................................
4646 validate :required_fields
You can’t perform that action at this time.
0 commit comments