To activate the testimonial
# File app/controllers/admin/testimonials_controller.rb, line 13 def activate respond_to do |format| if resource.update_attribute(:active, 'true') format.js {render 'referesh_datatable'} else format.js {redirect_to collection_path, alert: 'Unable to activate.'} end end end
To deactivate the testimonial
# File app/controllers/admin/testimonials_controller.rb, line 24 def deactivate respond_to do |format| if resource.update_attribute(:active, 'false') format.js {render 'referesh_datatable'} else format.js {redirect_to collection_path, alert: 'Unable to deactivate.'} end end end
To build testimonial image if image is not available
# File app/controllers/admin/testimonials_controller.rb, line 6 def resource @testimonial = super @testimonial.build_testimonial_image unless @testimonial.testimonial_image @testimonial end