Sha256: 696794a9cf309ac9494449368985d17792a06de1652c595630a0f2db1127df19

Contents?: true

Size: 431 Bytes

Versions: 22

Compression:

Stored size: 431 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
      question.followers << user unless follow_by_email.to_i.zero?
    end

  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rostra-0.0.10 app/models/rostra/answer.rb
rostra-0.0.9 app/models/rostra/answer.rb