mirror of
https://github.com/Retrospring/retrospring.git
synced 2025-01-18 14:05:59 +01:00
Adjust accessors to pull values from attributes if they exist
This has to be done because using multiple queries in a select statement does not automatically map into an ActiveRecord model and the values we want wait in the `self.attributes` hash.
This commit is contained in:
parent
997953565f
commit
b4cfc95c83
1 changed files with 4 additions and 0 deletions
|
@ -71,4 +71,8 @@ class Answer < ApplicationRecord
|
|||
def long? = content.length > SHORT_ANSWER_MAX_LENGTH
|
||||
|
||||
def pinned? = pinned_at.present?
|
||||
|
||||
def has_reacted = self.attributes["has_reacted"] || false
|
||||
|
||||
def is_subscribed = self.attributes["is_subscribed"] || false
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue