Raised group name maximum length to 255 characters (#13174).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11392 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-02-15 07:48:37 +00:00
parent 5891a873fb
commit ee1d9647b8
4 changed files with 19 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class Group < Principal
validates_presence_of :lastname
validates_uniqueness_of :lastname, :case_sensitive => false
validates_length_of :lastname, :maximum => 30
validates_length_of :lastname, :maximum => 255
before_destroy :remove_references_before_destroy

View File

@ -1,7 +1,7 @@
<%= error_messages_for @group %>
<div class="box tabular">
<p><%= f.text_field :name %></p>
<p><%= f.text_field :name, :required => true, :size => 60 %></p>
<% @group.custom_field_values.each do |value| %>
<p><%= custom_field_tag_with_label :group, value %></p>
<% end %>

View File

@ -0,0 +1,9 @@
class ChangeUsersLastnameLengthTo255 < ActiveRecord::Migration
def self.up
change_column :users, :lastname, :string, :limit => 255, :default => '', :null => false
end
def self.down
change_column :users, :lastname, :string, :limit => 30, :default => '', :null => false
end
end

View File

@ -35,6 +35,14 @@ class GroupTest < ActiveSupport::TestCase
assert_equal 'New group', g.name
end
def test_name_should_accept_255_characters
name = 'a' * 255
g = Group.new(:name => name)
assert g.save
g.reload
assert_equal name, g.name
end
def test_blank_name_error_message
set_language_if_valid 'en'
g = Group.new