Browse files

associated users with microposts

  • Loading branch information...
1 parent e5e4124 commit 24f218838c57377985a5d95ee4bc97f952bfa6a0 @testerindevelopment committed Oct 7, 2012
Showing with 7 additions and 0 deletions.
  1. +6 −0 app/models/micropost.rb
  2. +1 −0 app/models/user.rb
View
6 app/models/micropost.rb
@@ -1,3 +1,9 @@
class Micropost < ActiveRecord::Base
+
attr_accessible :content, :user_id
+
+ belongs_to :user
+
+ validates :content, :length => { :maximum => 140 }
+
end
View
1 app/models/user.rb
@@ -1,3 +1,4 @@
class User < ActiveRecord::Base
attr_accessible :email, :name
+ has_many :microposts
end

0 comments on commit 24f2188

Please sign in to comment.