Rails inappropriately does not handle for when the referrer is nil. 

Use this:

```ruby
  def redirect_back_or_to_default(path = "/")
    if referrer = request.headers["Referer"]
      redirect_to referrer
    else
      redirect_to path
    end
  end
```