]> source.dussan.org Git - redmine.git/commitdiff
Raised group name maximum length to 255 characters (#13174).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 15 Feb 2013 07:48:37 +0000 (07:48 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Fri, 15 Feb 2013 07:48:37 +0000 (07:48 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11392 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/group.rb
app/views/groups/_form.html.erb
db/migrate/20130215073721_change_users_lastname_length_to_255.rb [new file with mode: 0644]
test/unit/group_test.rb

index 23d2e39b499b7fb2a82be6208c90b62a27a70449..fd0f583f70503f2ce850ef7baafca42d5a3d3ea4 100644 (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
 
index a5cb5d068a05a9359fadb58cddb65773dafb50c4..7dc224061c39f00b695b05f4ca0ca148e1ce70a3 100644 (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 %>
diff --git a/db/migrate/20130215073721_change_users_lastname_length_to_255.rb b/db/migrate/20130215073721_change_users_lastname_length_to_255.rb
new file mode 100644 (file)
index 0000000..7d68e37
--- /dev/null
@@ -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
index c04583ae60c9c74a7c14d61a68a3918b360e4a95..53f1603e2cab2656671fda20d6b88130de82eadf 100644 (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