Sha256: 6f10f051e25c0157b5d0131422f5e75af6a6abaa5ffe657e655fc5f31bbb94ea

Contents?: true

Size: 312 Bytes

Versions: 3

Compression:

Stored size: 312 Bytes

Contents

module Storytime
  class Comment < ActiveRecord::Base
    belongs_to :user, class_name: Storytime.user_class.to_s
    belongs_to :post

    validates :user, presence: true
    validates :post_id, presence: true

    def commenter_name
      user.nil? ? "" : (user.storytime_name || user.email)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
storytime-1.1.1 app/models/storytime/comment.rb
storytime-1.0.7 app/models/storytime/comment.rb
storytime-1.0.6 app/models/storytime/comment.rb