Skip to content

Instantly share code, notes, and snippets.

View kwhandy's full-sized avatar
🍉
sharing-is-caring

Handy Wardhana kwhandy

🍉
sharing-is-caring
  • Indonesia
View GitHub Profile
@jcasimir
jcasimir / render_and_redirect.markdown
Created September 11, 2011 21:29
Render and Redirect in Rails 3

Render and Redirect

The normal controller/view flow is to display a view template corresponding to the current controller action, but sometimes we want to change that. We use render in a controller when we want to respond within the current request, and redirect_to when we want to spawn a new request.

Render

The render method is very overloaded in Rails. Most developers encounter it within the view template, using render :partial => 'form' or render @post.comments, but here we'll focus on usage within the controller.

:action

@penpenps
penpenps / index.html
Created September 24, 2015 02:40
Use XMLHttpRequest to upload file and handle it by Django
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" >
<title>XMLHttpRequest send file demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--set Document Mode to IE=edge -->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Le styles -->