Sha256: c4d9eb0485d1ab05398c7edd80b4d57ce4cb2f119818e4abc3afe823244078af

Contents?: true

Size: 415 Bytes

Versions: 3

Compression:

Stored size: 415 Bytes

Contents

module C80NewsTz
  class Comment < ActiveRecord::Base
    validates_with CommentValidator
    belongs_to :fact
    belongs_to :r_blurb
    belongs_to :user

    before_create :set_user_name

    def answers
      []
    end

    def blurb_or_fact
      if fact.present?
        fact
      else
        r_blurb
      end
    end

    private

    def set_user_name
      self.user_name = user.name
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
c80_news_tz-0.1.1.26 app/models/c80_news_tz/comment.rb
c80_news_tz-0.1.1.25 app/models/c80_news_tz/comment.rb
c80_news_tz-0.1.1.24 app/models/c80_news_tz/comments.rb