Class: AssessmentAttributesController
Instance Method Summary
collapse
#archivesspace, can_access?, permission_mappings, set_access_control
Instance Method Details
#current_record ⇒ Object
10
11
12
|
# File 'frontend/app/controllers/assessment_attributes_controller.rb', line 10
def current_record
@assessment_attribute_definitions
end
|
#edit ⇒ Object
6
7
8
|
# File 'frontend/app/controllers/assessment_attributes_controller.rb', line 6
def edit
@assessment_attribute_definitions = AssessmentAttributeDefinitions.find(nil)
end
|
#update ⇒ Object
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'frontend/app/controllers/assessment_attributes_controller.rb', line 14
def update
@assessment_attribute_definitions = AssessmentAttributeDefinitions.find(nil)
original_repo_formats = @assessment_attribute_definitions.repo_formats
original_repo_ratings = @assessment_attribute_definitions.repo_ratings
original_repo_conservation_issues = @assessment_attribute_definitions.repo_conservation_issues
@assessment_attribute_definitions.repo_formats = prepare(params[:formats])
@assessment_attribute_definitions.repo_ratings = prepare(params[:ratings])
@assessment_attribute_definitions.repo_conservation_issues = prepare(params[:conservation_issues])
begin
@assessment_attribute_definitions.save
@assessment_attribute_definitions = AssessmentAttributeDefinitions.find(nil)
flash.now[:success] = t('assessment_attribute_definitions._frontend.messages.updated')
rescue ConflictException => e
if "RECORD_IN_USE" == e.conflicts
flash.now[:error] = t('assessment_attribute_definitions._frontend.messages.attribute_in_use')
@assessment_attribute_definitions.repo_formats = revert_deletions(@assessment_attribute_definitions.repo_formats, original_repo_formats)
@assessment_attribute_definitions.repo_ratings = revert_deletions(@assessment_attribute_definitions.repo_ratings, original_repo_ratings)
@assessment_attribute_definitions.repo_conservation_issues = revert_deletions(@assessment_attribute_definitions.repo_conservation_issues, original_repo_conservation_issues)
else
flash.now[:error] = t('assessment_attribute_definitions._frontend.messages.conflict',
:conflicts => e.conflicts.join('; '))
end
end
render :template => 'assessment_attributes/edit'
end
|