Sha256: df7ff6f114cde2125813b6ec3335d280095b8e30b3cb500171993a19a6c103b9

Contents?: true

Size: 533 Bytes

Versions: 5

Compression:

Stored size: 533 Bytes

Contents

module Rostra
  class Answer < ActiveRecord::Base
    include Rostra::EmailNotifier

    belongs_to :question
    belongs_to :user

    acts_as_voteable
    acts_as_commentable

    validates :text, :presence => 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

5 entries across 5 versions & 1 rubygems

Version Path
rostra-0.1.19 app/models/rostra/answer.rb
rostra-0.1.18 app/models/rostra/answer.rb
rostra-0.1.17 app/models/rostra/answer.rb
rostra-0.1.16 app/models/rostra/answer.rb
rostra-0.1.15 app/models/rostra/answer.rb