diff options
author | francis <francis> | 2008-03-20 11:58:20 +0000 |
---|---|---|
committer | francis <francis> | 2008-03-20 11:58:20 +0000 |
commit | 9249268bd7d3b0585dda7b6a5943d44570aab823 (patch) | |
tree | 168fd143c816328b3844df321e69988be70bf5a3 /app/models | |
parent | 81b615fa3f2db6d26140cf2898666e138a15e027 (diff) |
Improvements to test code for requests, users and admin.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/post_redirect.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb index c2b2383d9..a55e32ce1 100644 --- a/app/models/post_redirect.rb +++ b/app/models/post_redirect.rb @@ -25,7 +25,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: post_redirect.rb,v 1.23 2008-03-18 19:18:51 francis Exp $ +# $Id: post_redirect.rb,v 1.24 2008-03-20 11:58:21 francis Exp $ require 'openssl' # for random bytes function @@ -52,6 +52,12 @@ class PostRedirect < ActiveRecord::Base YAML.load(self.reason_params_yaml) end + # Extract just local path part, without domain or # + def local_part_uri + self.uri.match(/^http:\/\/.+?(\/[^#]+)/) + return $1 + end + # Makes a random token, suitable for using in URLs e.g confirmation messages. def self.generate_random_token bits = 12 * 8 |