Displaying 1 result from an estimated 1 matches for "post_formstuff".
2006 Jun 08
3
Foreign key confusion
I have 2 models right now: "users" and "posts". When a user creates a 
post I would like their id to be recorded under "user_id" in the "posts" 
table. Under the "user" model I have:
class User < ActiveRecord::Base
      has_many :posts
end
And under the "posts" model I have:
class Post < ActiveRecord::Base
      belongs_to :user