This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Returns a blank 200 OK response for any form posts that include a value for the honeypot field | |
module Rack | |
class Honeypot | |
def initialize(app, field_name) | |
@app = app | |
@field_name = field_name | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ActionController::Base.class_eval do | |
protected | |
# BACKPORT OF CHANGE FROM 3.0 EDGE: http://github.com/rails/rails/commit/256b0ee8e3c1610967dfc89f864e24b98ed3c236 | |
# Returns true or false if a request is verified. Checks: | |
# | |
# * is the format restricted? By default, only HTML requests are checked. | |
# * is it a GET request? Gets should be safe and idempotent | |
# * Does the form_authenticity_token match the given token value from the params? | |
def self.verified_request? | |
!protect_against_forgery? || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hacks so that CouchRest::Document, which descends from Hash, | |
# doesn't appear to Rails routing as a Hash of options | |
class Hash | |
def self.===(other) | |
return false if other.is_a?(CouchRest::Document) | |
super | |
end | |
end | |
NewerOlder