Class: Admin::TestimonialsController

Inherits:
AdminController
  • Object
show all
Defined in:
app/controllers/c/admin/testimonials_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
# File 'app/controllers/c/admin/testimonials_controller.rb', line 12

def create
  @testimonial = C::Testimonial.new(testimonial_params)
  if @testimonial.save
    redirect_to testimonials_path, notice: 'Testimonial created'
  else
    render :new
  end
end

#destroyObject



29
30
31
32
33
34
35
# File 'app/controllers/c/admin/testimonials_controller.rb', line 29

def destroy
  @testimonial.destroy
  respond_to do |format|
    format.js
    format.html { redirect_to testimonials_path }
  end
end

#indexObject



8
9
10
# File 'app/controllers/c/admin/testimonials_controller.rb', line 8

def index
  @testimonials = filter_and_paginate(@testimonials, 'created_at desc')
end

#updateObject



21
22
23
24
25
26
27
# File 'app/controllers/c/admin/testimonials_controller.rb', line 21

def update
  if @testimonial.update(testimonial_params)
    redirect_to testimonials_path, notice: 'Testimonial updated'
  else
    render :edit
  end
end