leads_controller.rb
def activate # @leads = Lead.all.where("type = ? AND status = ?", Lead, true).order('id DESC').page(params[:page]) @lead = Lead.find(params[:id]) @lead.status = params[:status] @lead.save! respond_to do |format| format.js end end