Rails 特殊字元過濾(白名單)
filter_words = "Greg'\bs works" # \b: 表示退格鍵
ActionController::Base.helpers.sanitize(filter_words
=> "Greg's works"
ActionController::Base.helpers.sanitize("<script>I'am script</script>")
=> "I'am script"
filter_words = "Greg'\bs works" # \b: 表示退格鍵
ActionController::Base.helpers.sanitize(filter_words
=> "Greg's works"
ActionController::Base.helpers.sanitize("<script>I'am script</script>")
=> "I'am script"