Skip to content

Instantly share code, notes, and snippets.

Created October 29, 2016 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/16d65c98cf9d9c4afd2cf7d5ffbb66f8 to your computer and use it in GitHub Desktop.
Save anonymous/16d65c98cf9d9c4afd2cf7d5ffbb66f8 to your computer and use it in GitHub Desktop.
def toggle_quiz
if @quiz.update_attributes(active: params[:active])
respond_to do |format|
if @quiz.active
@ajax_status_text = "Successfully activated quiz"
@flash_status = "success"
else
@ajax_status_text = "Successfully deactivated quiz."
@flash_status = "warning"
end
format.js
end
else
@ajax_status_text = "Request Failed"
@flash_status = "error"
format.js
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment