many tiny changes

This commit is contained in:
jomo
2013-06-25 02:53:12 +02:00
parent c5dfdbeb8f
commit ceb39bf0c3
22 changed files with 209 additions and 80 deletions
+8
View File
@@ -4,4 +4,12 @@ class Blogpost < ActiveRecord::Base
belongs_to :user
has_many :comments
accepts_nested_attributes_for :comments
def author
@author ||= if user.present?
user
else
User.find_by_name("Deleted user")
end
end
end
+4
View File
@@ -1,6 +1,10 @@
class Comment < ActiveRecord::Base
attr_accessible :text, :user, :blogpost, :post
validates_presence_of :text, :user, :blogpost
validates_length_of :text, :in => 4..1000
belongs_to :blogpost
belongs_to :user
end