first release
This commit is contained in:
6
app/models/blogpost.rb
Normal file
6
app/models/blogpost.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class Blogpost < ActiveRecord::Base
|
||||
attr_accessible :title, :text
|
||||
validates_presence_of :title, :text, :user
|
||||
belongs_to :user
|
||||
has_many :comments
|
||||
end
|
||||
6
app/models/comment.rb
Normal file
6
app/models/comment.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
class Comment < ActiveRecord::Base
|
||||
attr_accessible :text, :user_id, :blogpost_id
|
||||
validates_presence_of :text, :user_id, :blogpost_id
|
||||
belongs_to :blogpost
|
||||
belongs_to :user
|
||||
end
|
||||
8
app/models/user.rb
Normal file
8
app/models/user.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
class User < ActiveRecord::Base
|
||||
attr_accessible :name, :ign, :email, :about, :password, :password_confirmation
|
||||
has_secure_password
|
||||
validates_presence_of :password, :on => :create
|
||||
|
||||
has_many :blogposts
|
||||
has_many :comments
|
||||
end
|
||||
Reference in New Issue
Block a user