Class: Alchemy::Admin::EssenceFilesController
- Inherits:
-
BaseController
- Object
- ApplicationController
- BaseController
- BaseController
- Alchemy::Admin::EssenceFilesController
- Defined in:
- app/controllers/alchemy/admin/essence_files_controller.rb
Instance Method Summary collapse
-
#assign ⇒ Object
Assigns file, but does not saves it.
- #edit ⇒ Object
- #update ⇒ Object
Methods inherited from BaseController
Methods included from Modules
included, #module_definition_for, register_module
Methods included from Alchemy::AbilityHelper
Methods included from ConfigurationMethods
#configuration, #multi_language?, #multi_site?, #prefix_locale?
Instance Method Details
#assign ⇒ Object
Assigns file, but does not saves it.
When the user saves the element the content gets updated as well.
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 24 def assign @content = Content.find_by(id: params[:content_id]) @attachment = Attachment.find_by(id: params[:attachment_id]) @content.essence. = @attachment # We need to update timestamp here because we don't save yet, # but the cache needs to be get invalid. @content.touch end |
#edit ⇒ Object
12 13 14 |
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 12 def edit @content = @essence_file.content end |
#update ⇒ Object
16 17 18 |
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 16 def update @essence_file.update(essence_file_params) end |