fixes #1639
This commit is contained in:
@@ -117,7 +117,7 @@ class TagAlias < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def ensure_category_consistency
|
||||
if antecedent_tag.category != consequent_tag.category
|
||||
if antecedent_tag.category != consequent_tag.category && antecedent_tag.category != Tag.categories.general
|
||||
consequent_tag.update_attribute(:category, antecedent_tag.category)
|
||||
consequent_tag.update_category_cache_for_all
|
||||
end
|
||||
|
||||
@@ -62,9 +62,11 @@ class TagAliasTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
|
||||
should "not push the antecedent's category to the consequent if the antecedent is general"
|
||||
|
||||
should "push the antecedent's category to the consequent" do
|
||||
tag1 = FactoryGirl.create(:tag, :name => "aaa", :category => 1)
|
||||
tag2 = FactoryGirl.create(:tag, :name => "bbb")
|
||||
tag1 = FactoryGirl.create(:tag, :name => "aaa")
|
||||
tag2 = FactoryGirl.create(:tag, :name => "bbb", :category => 1)
|
||||
ta = FactoryGirl.create(:tag_alias, :antecedent_name => "aaa", :consequent_name => "bbb")
|
||||
tag2.reload
|
||||
assert_equal(1, tag2.category)
|
||||
|
||||
Reference in New Issue
Block a user