Sha256: 795c8391ecdea1d6b5aa8ba0a2aee096779349b137ed109f131c3ee779ee754d
Contents?: true
Size: 977 Bytes
Versions: 2
Compression:
Stored size: 977 Bytes
Contents
class Pulitzer::ContentElementsController < Pulitzer::ApplicationController before_action :set_content_element, only: [:show, :edit, :update] def show render partial: 'show', locals: { content_element: @content_element } end def edit render partial: 'form', locals: { content_element: @content_element } end def update @content_element.update content_element_params render partial: 'show', locals: { content_element: @content_element } end def update_all content_elements = Pulitzer::ContentElement.find params[:content_element] content_elements.each do |ce| new_sort_order = params[:content_element].index(ce.id.to_s) ce.update_attribute(:sort_order, new_sort_order) end head :ok end protected def content_element_params params[:content_element].nil? ? {} : params[:content_element].permit! end def set_content_element @content_element = Pulitzer::ContentElement.find(params[:id]) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pulitzer-0.13.1 | app/controllers/pulitzer/content_elements_controller.rb |
pulitzer-0.13.0 | app/controllers/pulitzer/content_elements_controller.rb |