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 ConfigurationMethods
#configuration, #multi_language?, #multi_site?
Instance Method Details
#assign ⇒ Object
Assigns file, but does not saves it.
When the user saves the element the content gets updated as well.
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 23 def assign @content = Content.find_by(id: params[:content_id]) @attachment = Attachment.find_by(id: params[:attachment_id]) @content.essence. = @attachment @options = # We need to update timestamp here because we don't save yet, # but the cache needs to be get invalid. # And we don't user @content.touch here, because that updates # also the element and page timestamps what we don't want yet. @content.update_column(:updated_at, Time.now) end |
#edit ⇒ Object
10 11 12 13 |
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 10 def edit @content = @essence_file.content @options = end |
#update ⇒ Object
15 16 17 |
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 15 def update @essence_file.update(essence_file_params) end |