aboutsummaryrefslogtreecommitdiffstats
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/info_request.rb3
-rw-r--r--app/models/public_body.rb9
-rw-r--r--app/models/user.rb2
3 files changed, 8 insertions, 6 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index a36b140b8..b9c39e89d 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -612,7 +612,8 @@ public
# last_event_forming_initial_request. There may be more obscure
# things, e.g. fees, not properly covered.
def date_response_required_by
- return Holiday.due_date_from(self.date_initial_request_last_sent_at, 7)
+ days_later = MySociety::Config.get('REPLY_LATE_AFTER_DAYS', 20)
+ return Holiday.due_date_from(self.date_initial_request_last_sent_at, days_later)
end
# This is a long stop - even with UK public interest test extensions, 40
# days is a very long time.
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index b68722b81..8c749b1df 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -54,11 +54,12 @@ class PublicBody < ActiveRecord::Base
# like find_by_url_name but also search historic url_name if none found
def self.find_by_url_name_with_historic(name)
- @localer = I18n.locale.to_s
+ @locale = I18n.locale.to_s
PublicBody.with_locale(@locale) do
- found = PublicBody.find(:all,
- :conditions => ["public_body_translations.url_name='#{name}' AND public_body_translations.locale = '#{@localer}'"],
- :joins => :translations)
+ found = PublicBody.find(:all,
+ :conditions => ["public_body_translations.url_name='#{name}'"],
+ :joins => :translations,
+ :readonly => false)
return found.first if found.size == 1
# Shouldn't we just make url_name unique?
raise "Two bodies with the same URL name: #{name}" if found.size > 1
diff --git a/app/models/user.rb b/app/models/user.rb
index e199eb352..e29ae3101 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -103,7 +103,7 @@ class User < ActiveRecord::Base
def validate
if self.email != "" && !MySociety::Validate.is_valid_email(self.email)
- errors.add(_("Please enter a valid email address"))
+ errors.add(:email, _("Please enter a valid email address"))
end
if MySociety::Validate.is_valid_email(self.name)
errors.add(:name, _("Please enter your name, not your email address, in the name field."))