You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
694 B
23 lines
694 B
6 years ago
|
class Ecs::SaveGraduationCourseSupportsService < ApplicationService
|
||
|
include AcceptsNestedAttributesHelper
|
||
|
|
||
|
attr_reader :graduation_subitem, :params
|
||
|
|
||
|
def initialize(graduation_subitem, params)
|
||
|
@params = params
|
||
|
@graduation_subitem = graduation_subitem
|
||
|
end
|
||
|
|
||
|
def call
|
||
|
Ecs::SaveGraduationCourseSupportForm.new(params).validate!
|
||
|
|
||
|
accepts_attributes = build_accepts_nested_attributes(
|
||
|
graduation_subitem, graduation_subitem.ec_course_supports,
|
||
|
params[:course_supports]
|
||
|
)
|
||
|
|
||
|
graduation_subitem.assign_attributes(ec_course_supports_attributes: accepts_attributes)
|
||
|
graduation_subitem.save!
|
||
|
graduation_subitem
|
||
|
end
|
||
|
end
|