Method: Pageflow::Editor::FilesController#reuse

Defined in:
app/controllers/pageflow/editor/files_controller.rb

#reuseObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/controllers/pageflow/editor/files_controller.rb', line 31

def reuse
  entry = DraftEntry.find(params[:entry_id])
  other_entry = DraftEntry.find(file_reuse_params[:other_entry_id])

  file_reuse = FileReuse.new(entry, other_entry, file_type, file_reuse_params[:file_id])

  authorize!(:edit, entry.to_model)
  authorize!(:use, file_reuse.file.to_model)
  verify_edit_lock!(entry)

  file_reuse.save!

  redirect_to(editor_entry_url(entry))
end