Skip to content

Commit

Permalink
WIP: fix crash when adding file attachment to problem
Browse files Browse the repository at this point in the history
There was an incomplete rename in commit 1e93118 (enable file
attachments for problems, with shared code for filelinks of groups and
problems, 2013-12-19). Triggers error when trying to add a file
attachment to a problem and there is a validation failure.
  • Loading branch information
tom93 committed Jan 8, 2024
1 parent b26315e commit ef7adc3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/filelinks/roots_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ def create
self.model = load_model
authorize model, :update?
authorize FileAttachment.find(filelink_params[:file_attachment_id]), :use?
@new_file = model.filelinks.build(filelink_params)
if @new_file.save
@new_filelink = model.filelinks.build(filelink_params)
if @new_filelink.save
redirect_to(index_path, :notice => "File attachment added")
else
@files = model.filelinks.order(:filepath)
@filelinks = model.filelinks.order(:filepath)
render :action => :index
end
end
Expand Down

0 comments on commit ef7adc3

Please sign in to comment.