Class: Rostra::Question
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Rostra::Question
- Extended by:
- FriendlyId
- Defined in:
- app/models/rostra/question.rb
Instance Attribute Summary collapse
-
#follow_by_email ⇒ Object
Returns the value of attribute follow_by_email.
Class Method Summary collapse
-
.trending(limit = 5) ⇒ Object
Finds questions asked within the last 30 days ordered by non-unique page views.
Instance Method Summary collapse
Instance Attribute Details
#follow_by_email ⇒ Object
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
.trending(limit = 5) ⇒ Object
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_count ⇒ Object
33 34 35 |
# File 'app/models/rostra/question.rb', line 33 def answer_count @answer_count = answers.count end |