Sha256: f7f91074ed0ed6a1773bd87cc24e82ee9a4ffa671dee65ba0660c29e63afcb58
Contents?: true
Size: 586 Bytes
Versions: 9
Compression:
Stored size: 586 Bytes
Contents
module Rostra class Answer < ActiveRecord::Base include Rostra::EmailNotifier include Rostra::TimestampObserver belongs_to :question belongs_to :user acts_as_voteable acts_as_commentable validates :text, presence: true, uniqueness: true before_save :create_question_following attr_accessor :follow_by_email private def create_question_following opted_not_to_follow = follow_by_email.to_i.zero? unless opted_not_to_follow || question.followers.exists?(user) question.followers << user end end end end
Version data entries
9 entries across 9 versions & 1 rubygems