Class: Pulitzer::CustomOptionsController

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

Instance Method Summary collapse

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
# File 'app/controllers/pulitzer/custom_options_controller.rb', line 23

def create
  @custom_option = CustomOption.new(custom_option_params)
  if @custom_option.save
    render partial: 'show_wrapper', locals: { custom_option: @custom_option }
  else
    render partial: 'new', locals: { custom_option: @custom_option }, status: 409
  end
end

#destroyObject



40
41
42
43
# File 'app/controllers/pulitzer/custom_options_controller.rb', line 40

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

#editObject



15
16
17
# File 'app/controllers/pulitzer/custom_options_controller.rb', line 15

def edit
  render_ajax locals: { custom_option: @custom_option }
end

#indexObject



5
6
7
8
# File 'app/controllers/pulitzer/custom_options_controller.rb', line 5

def index
  @custom_options = CustomOption.all
  render_ajax
end

#newObject



10
11
12
13
# File 'app/controllers/pulitzer/custom_options_controller.rb', line 10

def new
  @custom_option = CustomOption.new(custom_option_params)
  render_ajax locals: { custom_option: @custom_option }
end

#showObject



19
20
21
# File 'app/controllers/pulitzer/custom_options_controller.rb', line 19

def show
  render_ajax locals: { custom_option: @custom_option }
end

#updateObject



32
33
34
35
36
37
38
# File 'app/controllers/pulitzer/custom_options_controller.rb', line 32

def update
  if @custom_option.update_attributes(custom_option_params)
    render partial: 'show', locals: { custom_option: @custom_option }
  else
    render partial: 'edit', locals: { custom_option: @custom_option }, status: 409
  end
end