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 ConfigurationMethods

#configuration, #multi_language?, #multi_site?

Instance Method Details

#assignObject

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

  # 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

#editObject



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

def edit
  @content = @essence_file.content
  @options = options_from_params
end

#updateObject



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

def update
  @essence_file.update(essence_file_params)
end