Class: Question
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Question
- Defined in:
- app/models/question.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.crd_per_page ⇒ Object
34 35 36 |
# File 'app/models/question.rb', line 34 def self.crd_per_page 5 end |
Instance Method Details
#answer_body ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/models/question.rb', line 38 def answer_body text = "" self.reload self.answers.each do |answer| text += answer.body end return text end |
#last_updated_at ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/models/question.rb', line 51 def last_updated_at if answers.last time = answers.last.updated_at end if time if time > updated_at time else updated_at end else updated_at end end |
#username ⇒ Object
47 48 49 |
# File 'app/models/question.rb', line 47 def username self.user.try(:username) end |