aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/info_request.rb
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-09-09 16:02:01 +0100
committerLouise Crow <louise.crow@gmail.com>2013-09-17 17:20:06 +0100
commit777ed1016b23d577f4cee62f49961e1d44bc346d (patch)
treeb53ab06ca56f3d5d58b8533ba2178d4ce6563fbd /app/models/info_request.rb
parent1336bf24bbca504e45480ea1b53eb1efca0f8e40 (diff)
Allow a unicode-only title in validation
Diffstat (limited to 'app/models/info_request.rb')
-rw-r--r--app/models/info_request.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index c0b8e2fca..d9a1a65fe 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
# == Schema Information
# Schema version: 20120919140404
#
@@ -31,7 +32,10 @@ class InfoRequest < ActiveRecord::Base
strip_attributes!
validates_presence_of :title, :message => N_("Please enter a summary of your request")
- validates_format_of :title, :with => /[a-zA-Z]/, :message => N_("Please write a summary with some text in it"), :if => Proc.new { |info_request| !info_request.title.nil? && !info_request.title.empty? }
+ # TODO: When we no longer support Ruby 1.8, this can be done with /[[:alpha:]]/
+ validates_format_of :title, :with => /[ёЁа-яА-Яa-zA-Zà-üÀ-Ü]/iu,
+ :message => N_("Please write a summary with some text in it"),
+ :if => Proc.new { |info_request| !info_request.title.nil? && !info_request.title.empty? }
belongs_to :user
validate :must_be_internal_or_external