diff --git a/app/models/group.rb b/app/models/group.rb index 23d2e39b4..fd0f583f7 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -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 diff --git a/app/views/groups/_form.html.erb b/app/views/groups/_form.html.erb index a5cb5d068..7dc224061 100644 --- a/app/views/groups/_form.html.erb +++ b/app/views/groups/_form.html.erb @@ -1,7 +1,7 @@ <%= error_messages_for @group %>
<%= f.text_field :name %>
+<%= f.text_field :name, :required => true, :size => 60 %>
<% @group.custom_field_values.each do |value| %><%= custom_field_tag_with_label :group, value %>
<% 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 index 000000000..7d68e37d8 --- /dev/null +++ b/db/migrate/20130215073721_change_users_lastname_length_to_255.rb @@ -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 diff --git a/test/unit/group_test.rb b/test/unit/group_test.rb index c04583ae6..53f1603e2 100644 --- a/test/unit/group_test.rb +++ b/test/unit/group_test.rb @@ -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