FIX: update topic fancy title when updating category name

This commit is contained in:
Arpit Jalan 2017-03-26 12:29:53 +05:30
parent dfe1d3adfd
commit 3378e2d49f
2 changed files with 2 additions and 1 deletions

View File

@ -463,7 +463,7 @@ SQL
old_name = changed_attributes["name"] old_name = changed_attributes["name"]
return unless topic.present? return unless topic.present?
if topic.title == I18n.t("category.topic_prefix", category: old_name) if topic.title == I18n.t("category.topic_prefix", category: old_name)
topic.update_column(:title, I18n.t("category.topic_prefix", category: name)) topic.update_attribute(:title, I18n.t("category.topic_prefix", category: name))
end end
end end

View File

@ -310,6 +310,7 @@ describe Category do
@category.update_attributes(name: 'Troutfishing') @category.update_attributes(name: 'Troutfishing')
@topic.reload @topic.reload
expect(@topic.title).to match(/Troutfishing/) expect(@topic.title).to match(/Troutfishing/)
expect(@topic.fancy_title).to match(/Troutfishing/)
end end
it "doesn't raise an error if there is no definition topic to rename (uncategorized)" do it "doesn't raise an error if there is no definition topic to rename (uncategorized)" do