Class: Pageflow::Editor::FileUsagesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Pageflow::Editor::FileUsagesController
- Defined in:
- app/controllers/pageflow/editor/file_usages_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'app/controllers/pageflow/editor/file_usages_controller.rb', line 8 def create entry = DraftEntry.find(params[:entry_id]) file = FileUsage.where(file_usage_params).first!.file (:use, file) (:edit, entry.to_model) usage = entry.add_file(file) respond_with(:editor, usage) end |
#destroy ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/pageflow/editor/file_usages_controller.rb', line 19 def destroy usage = FileUsage.find(params[:id]) entry = DraftEntry.for_file_usage(usage) (:edit, entry.to_model) verify_edit_lock!(entry) entry.remove_file(usage.file) head(:no_content) end |