strip more than 5 tags when updating profile so people with broken profiles can update again
This commit is contained in:
parent
aa478ddd5c
commit
5392b5c6ef
2 changed files with 7 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue