add user_id to new record

In your Controller's #new and #create methods, scope the post to be owned by the current_user (or whatever other scheme you may be using for your logged-in-user management).

def new
  @post =

def create
  @post = current_user.posts.create(post_params)

Now your relationship will take care of getting the correct user in there automatically, whether it's in-memory or in persistence.

NB: If this doesn't appear to work, then you haven't built your relationships correctly, and you need to fix that before proceeding.


Ok thanks And what about passing some params to build?

@post = current_user.posts.buil(artist_id:, tour_id: