class Admin::TestimonialsController

Public Instance Methods

activate() click to toggle source

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
deactivate() click to toggle source

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
resource() click to toggle source

To build testimonial image if image is not available

Calls superclass method
# File app/controllers/admin/testimonials_controller.rb, line 6
def resource
  @testimonial = super
  @testimonial.build_testimonial_image unless @testimonial.testimonial_image
  @testimonial
end