diff options
author | Robin Houston <robin.houston@gmail.com> | 2012-06-06 16:26:22 +0100 |
---|---|---|
committer | Robin Houston <robin.houston@gmail.com> | 2012-06-06 19:35:13 +0100 |
commit | 67af40e3b1ec14f3da98fd5acc0303476af9d39a (patch) | |
tree | 9d26c7b2a3fae19191390d9c37671fd6cd922dcb /app/models/info_request.rb | |
parent | 324b7fa4c6d157cd4a849e181d3fb304145a4977 (diff) |
Non-logged-in users can create requests
Make the info_request validation a bit more forgiving, so that non-
logged-in users may create requests.
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r-- | app/models/info_request.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 99cbe476a..6cefc3dab 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -113,9 +113,9 @@ class InfoRequest < ActiveRecord::Base # External requests are requests that have been added using the API, whereas internal # requests are requests made using the site. def must_be_internal_or_external - if user_id.nil? - errors.add(:external_url, "must be provided for an external request") if external_url.nil? - else + # We must permit user_id and external_user_name both to be nil, because the system + # allows a request to be created by a non-logged-in user. + if !user_id.nil? errors.add(:external_user_name, "must be null for an internal request") if !external_user_name.nil? errors.add(:external_url, "must be null for an internal request") if !external_url.nil? end |