Sha256: 69562596ae847665e6c8339cee938c11a37e84b35024fcddd0929710ad29815a
Contents?: true
Size: 1.33 KB
Versions: 11
Compression:
Stored size: 1.33 KB
Contents
module Alchemy module Admin class EssenceFilesController < Alchemy::Admin::BaseController authorize_resource class: Alchemy::EssenceFile before_filter :load_essence_file, only: [:edit, :update] helper "Alchemy::Admin::Contents" def edit @content = @essence_file.content @options = options_from_params end def update @essence_file.update(essence_file_params) end # Assigns file, but does not saves it. # # When the user saves the element the content gets updated as well. # 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 private def essence_file_params params.require(:essence_file).permit(:title, :css_class) end def load_essence_file @essence_file = EssenceFile.find(params[:id]) end end end end
Version data entries
11 entries across 11 versions & 2 rubygems