Merge pull request #467 from warpc/429-uname_format_error_explain

[refs #429] Add format explain error message for uname
This commit is contained in:
Vladimir Sharshov 2012-05-16 03:04:18 -07:00
commit bb8eab62c9
3 changed files with 7 additions and 1 deletions

View File

@ -21,7 +21,7 @@ class Project < ActiveRecord::Base
has_many :advisories # should be without :dependent => :destroy
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^#{NAME_REGEXP}$/}
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^#{NAME_REGEXP}$/, :message => I18n.t("activerecord.errors.project.uname")}
validates :owner, :presence => true
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }

View File

@ -88,3 +88,6 @@ en:
group: Group
default_branch: Default branch
is_rpm: Project is a packet
errors:
project:
uname: The name can only use lower case Latin letters (a-z), numbers (0-9) and underscore (_)

View File

@ -88,3 +88,6 @@ ru:
group: Группа
default_branch: Ветка по умолчанию
is_rpm: Проект является пакетом
errors:
project:
uname: В имени можно использовать только строчные символы латинского алфавита (a-z), цифры (0-9) и символ нижнего подчеркивания (_)