Sha256: cecfbe706011d9b6a208767b98c0c46c5be1d085cba9ea93a957278d7f2e2c6a
Contents?: true
Size: 1.48 KB
Versions: 19
Compression:
Stored size: 1.48 KB
Contents
class Pulitzer::JustificationStylesController < Pulitzer::ApplicationController before_action :get_justification_style, only: [:show, :edit, :update, :destroy] def new @justification_style = Pulitzer::JustificationStyle.new(justification_style_params) render partial: 'new', locals: {justification_style: @justification_style} end def create @justification_style = Pulitzer::JustificationStyle.create(justification_style_params) if @justification_style.errors.empty? render partial: 'show_wrapper', locals: {justification_style: @justification_style} else render partial: 'new', locals: {justification_style: @justification_style}, status: 409 end end def show render partial: 'show', locals: {justification_style: @justification_style} end def edit render partial: 'form', locals: {justification_style: @justification_style} end def update @justification_style.update_attributes(justification_style_params) if @justification_style.errors.empty? render partial: 'show', locals: {justification_style: @justification_style} else render partial: 'form', locals: {justification_style: @justification_style}, status: 409 end end def destroy @justification_style.destroy head :ok and return end protected def get_justification_style @justification_style = Pulitzer::JustificationStyle.find(params[:id]) end def justification_style_params params[:justification_style].permit! end end
Version data entries
19 entries across 19 versions & 1 rubygems