Skip to content
Extraits de code Groupes Projets
Valider 5392b5c6 rédigé par maxwell's avatar maxwell
Parcourir les fichiers

strip more than 5 tags when updating profile so people with broken profiles can update again

parent aa478ddd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -40,7 +40,9 @@ class Profile < ActiveRecord::Base
:image_url_small, :birthday, :gender, :bio, :location, :searchable, :date, :tag_string
belongs_to :person
before_validation do
self.tag_string = self.tag_string.split[0..4].join(' ')
end
before_save do
self.build_tags
end
......
......@@ -188,9 +188,11 @@ describe Profile do
@object.should be_valid
end
it 'allows no more than 5 tags' do
it 'strips more than 5 tags' do
@object.tag_string = '#one #two #three #four #five #six'
@object.should_not be_valid
@object.save
@object.tags.count.should == 5
puts @object.tag_string
end
it_should_behave_like 'it is taggable'
end
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter