Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Mod: 限制推荐话题数为8个

  • Loading branch information...
commit 23f9d55edc0cc8dd887bd9d63a302a8b6d3125bf 1 parent 924c988
@huacnlee authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  app/models/ask_suggest_topic.rb
View
3  app/models/ask_suggest_topic.rb
@@ -15,6 +15,9 @@ def self.find_by_ask(ask)
topics = Topic.any_in(:name => words.collect { |w| /^#{w}$/i } )
topics.sort { |a,b| b.followers_count <=> a.followers_count }
topics_array = topics.collect { |t| t.name }
+ if topics_array.length > 8
+ topics_array = topics_array[0,8]
+ end
item.topics = topics_array
item.save
Please sign in to comment.
Something went wrong with that request. Please try again.