Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## question.rb
- class Question < ActiveRecord::Base
- def self.calculate_popular
- all(:conditions => { :counted => false }).each do |question|
- iq = IndexQuestion.find_or_create_by_question({ :question => question.question })
- iq.increment! :count
- question.update_attribute :counted, true
- end
- end
- end
Add Comment
Please, Sign In to add comment