many things, comments working.

This commit is contained in:
jomo
2013-06-24 13:29:39 +02:00
parent 7a894f4f6a
commit fb52e8bed2
44 changed files with 490 additions and 223 deletions

View File

@@ -3,4 +3,5 @@ class Blogpost < ActiveRecord::Base
validates_presence_of :title, :text, :user
belongs_to :user
has_many :comments
accepts_nested_attributes_for :comments
end

View File

@@ -1,6 +1,6 @@
class Comment < ActiveRecord::Base
attr_accessible :text, :user_id, :blogpost_id
attr_accessible :text, :user_id, :blogpost, :post
validates_presence_of :text, :user_id, :blogpost_id
belongs_to :blogpost
belongs_to :user
end
end

View File

@@ -1,7 +1,10 @@
class User < ActiveRecord::Base
attr_accessible :name, :ign, :email, :about, :password, :password_confirmation
attr_accessible :name, :ign, :email, :about, :password, :password_confirmation, :rank
has_secure_password
validates_presence_of :password, :on => :create
validates_presence_of :password, :name, :email, :ign, :password_confirmation, :on => :create
validates :email, :uniqueness => true
validates :name, :uniqueness => true
validates :ign, :uniqueness => true
has_many :blogposts
has_many :comments