Class: Rostra::Question

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/rostra/question.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#follow_by_emailObject

Returns the value of attribute follow_by_email.



21
22
23
# File 'app/models/rostra/question.rb', line 21

def follow_by_email
  @follow_by_email
end

Class Method Details

Finds questions asked within the last 30 days ordered by non-unique page views.



29
30
31
# File 'app/models/rostra/question.rb', line 29

def self.trending(limit = 5)
  Question.where(created_at: (30.days.ago)..(Time.now)).limit(limit).order('impressions_count desc')
end

Instance Method Details

#answer_countObject



33
34
35
# File 'app/models/rostra/question.rb', line 33

def answer_count
  @answer_count = answers.count
end