another big commit :D
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user