Class: Alchemy::Admin::EssenceFilesController

Inherits:
BaseController show all
Defined in:
app/controllers/alchemy/admin/essence_files_controller.rb

Instance Method Summary collapse

Methods inherited from BaseController

#leave

Methods included from Modules

included, #module_definition_for, register_module

Methods included from Alchemy::AbilityHelper

#current_ability

Methods included from ConfigurationMethods

#configuration, #multi_language?, #multi_site?, #prefix_locale?

Instance Method Details

#assignObject

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 = @attachment

  # We need to update timestamp here because we don't save yet,
  # but the cache needs to be get invalid.
  @content.touch
end

#editObject



12
13
14
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 12

def edit
  @content = @essence_file.content
end

#updateObject



16
17
18
# File 'app/controllers/alchemy/admin/essence_files_controller.rb', line 16

def update
  @essence_file.update(essence_file_params)
end