Skip to content
Browse files

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

  • Loading branch information...
1 parent 924c988 commit 23f9d55edc0cc8dd887bd9d63a302a8b6d3125bf @huacnlee committed May 17, 2011
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

0 comments on commit 23f9d55

Please sign in to comment.
Something went wrong with that request. Please try again.