Class: Pulitzer::JustificationStylesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/pulitzer/justification_styles_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
# File 'app/controllers/pulitzer/justification_styles_controller.rb', line 9

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

#destroyObject



35
36
37
38
# File 'app/controllers/pulitzer/justification_styles_controller.rb', line 35

def destroy
  @justification_style.destroy
  head :ok and return
end

#editObject



22
23
24
# File 'app/controllers/pulitzer/justification_styles_controller.rb', line 22

def edit
  render partial: 'form', locals: {justification_style: @justification_style}
end

#newObject



4
5
6
7
# File 'app/controllers/pulitzer/justification_styles_controller.rb', line 4

def new
  @justification_style = Pulitzer::JustificationStyle.new(justification_style_params)
  render partial: 'new', locals: {justification_style: @justification_style}
end

#showObject



18
19
20
# File 'app/controllers/pulitzer/justification_styles_controller.rb', line 18

def show
  render partial: 'show', locals: {justification_style: @justification_style}
end

#updateObject



26
27
28
29
30
31
32
33
# File 'app/controllers/pulitzer/justification_styles_controller.rb', line 26

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