Merge branch 'stable' into develop

This commit is contained in:
Dennis Schubert 2016-03-03 17:58:05 +01:00
commit 75c3e6068c
3 changed files with 8 additions and 1 deletions

View file

@ -132,6 +132,7 @@ Contributions are very welcome, the hard work is done!
# 0.5.8.0
## Refactor
* Sort tag autocompletion by tag name [#6734](https://github.com/diaspora/diaspora/pull/6734)
## Bug fixes
* Fix empty name field when editing aspect names [#6706](https://github.com/diaspora/diaspora/pull/6706)

View file

@ -8,7 +8,7 @@ module ActsAsTaggableOn
end
def self.autocomplete(name)
where("name LIKE ?", "#{name.downcase}%")
where("name LIKE ?", "#{name.downcase}%").order("name ASC")
end
def self.normalize(name)

View file

@ -13,6 +13,12 @@ describe ActsAsTaggableOn::Tag, :type => :model do
it "does an end where on tags" do
expect(tag.autocomplete("CAT")).to eq([tag_cats])
end
it "sorts the results by name" do
tag_cat = tag.create(name: "cat")
tag_catt = tag.create(name: "catt")
expect(tag.autocomplete("CAT")).to eq([tag_cat, tag_cats, tag_catt])
end
end
describe ".normalize" do