If I have two models:
class Post < ActiveRecord::Base belongs_to :user end
and
class User < ActiveRecord::Base has_many :posts end
If I do this:
post = Post.new user = User.new post.user = user post.save
Is the user and primary key assigned in the post user_id field user_id ?
ruby-on-rails activerecord associations
hsribei
source share