another big commit :D

This commit is contained in:
jomo
2013-10-07 04:59:21 +02:00
parent 2761387703
commit 5fac505a31
74 changed files with 1003 additions and 357 deletions

View File

@@ -1,10 +1,17 @@
class Comment < ActiveRecord::Base
attr_accessible :text, :user, :blogpost, :post
validates_presence_of :text, :user, :blogpost
validates_length_of :text, :in => 4..1000
attr_accessible :content, :author, :blogpost, :post
validates_presence_of :content, :author, :blogpost
validates_length_of :content, in: 4..1000
belongs_to :blogpost
belongs_to :user
belongs_to :user_author, class_name: "User", foreign_key: "user_author_id"
def author
@author ||= if self.user_author.present?
user_author
else
User.first
end
end
end