Skip to content

Instantly share code, notes, and snippets.

@ruprict
Created March 18, 2012 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ruprict/2072748 to your computer and use it in GitHub Desktop.
Save ruprict/2072748 to your computer and use it in GitHub Desktop.
Kennedy Article on Rails Secuity
<?php
// ...
protected function build_params() {
$whitelist = array("name", "surname");
$params = array();
foreach($_POST as $key => $value) {
if (in_array($key, $whitelist)) {
$params[":$key"] = $value;
}
}
return $params;
}
// ...
?>
@wilmoore
Copy link

FYI, a bit more terse: https://gist.github.com/2140151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment