Sha256: a580bd107cf60e64da0f3979b483c581011580fa245938ecf977952c01350325
Contents?: true
Size: 975 Bytes
Versions: 8
Compression:
Stored size: 975 Bytes
Contents
# frozen_string_literal: true require_dependency 'c/admin_controller' module C class Admin::TestimonialsController < AdminController load_and_authorize_resource class: C::Testimonial def index @testimonials = filter_and_paginate(@testimonials, 'created_at desc') end def create @testimonial = C::Testimonial.new(testimonial_params) if @testimonial.save redirect_to testimonials_path, notice: 'Testimonial created' else render :new end end def update if @testimonial.update(testimonial_params) redirect_to testimonials_path, notice: 'Testimonial updated' else render :edit end end def destroy @testimonial.destroy respond_to do |format| format.js format.html { redirect_to testimonials_path } end end private def testimonial_params params.require(:testimonial).permit(:author, :quote) end end end
Version data entries
8 entries across 8 versions & 1 rubygems