Sha256: e26518d85d4a93ddebbebefe0da0ba2f0d15f13374ddaf350b9a5bbf653e0118
Contents?: true
Size: 1.35 KB
Versions: 10
Compression:
Stored size: 1.35 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.current) end private def essence_file_params params.require(:essence_file).permit(:title, :css_class, :link_text) end def load_essence_file @essence_file = EssenceFile.find(params[:id]) end end end end
Version data entries
10 entries across 10 versions & 1 rubygems