Class: Admin::TestimonialsController
- Inherits:
-
AdminController
- Object
- AdminController
- Admin::TestimonialsController
- Defined in:
- app/controllers/c/admin/testimonials_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
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 |
#destroy ⇒ Object
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 |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/c/admin/testimonials_controller.rb', line 8 def index @testimonials = filter_and_paginate(@testimonials, 'created_at desc') end |
#update ⇒ Object
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 |