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
<%= 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 %>
--- /dev/null
+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
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