title: How to set a users post id to their post
body: <p>I'm having issues associating a users status post to them, I also can't get it to show on their account. </p>
  
  <p>This is in my users_controller</p>
  
  <pre><code>class UsersController &lt; ApplicationController
    before_action :set_user, only: [:show, :edit, :update, :destroy]
    after_action :signed_in_after_register, only: :create 
  
    def index
      @users = User.all
  
    end
  
    def profile 
      @user = User.find(session[:user_id]) unless session[:user_id] == ""
      redirect_to login_path, notice: "You're not logged in" unless @user 
      @posts = @user.posts
    end 
  
    def _nav
       @user = User.find(session[:user_id])
    end
  
    def destroy
      @user = User.find(session[:user_id])
    end
  
    def welcome
      @user = User.find(session[:user_id])
    end
  
    def show
      @user = Post.first.update_attributes(user_id: 1)
      @post = Post.first.update_attributes(@signed_in_user)
    end
  
     def new
      @post = Post.new(params[:post_id])
      @user = User.new
    end
  
    def edit
    end
  
    def create
      @post.user = current.user
      @user = User.new(user_params)
      respond_to do |format|
        if @user.save
          format.html { redirect_to profile_path, notice: 'User was successfully created.' }
          format.json { render :show, status: :created, location: @user }
        else
          format.html { render :new }
          format.json { render json: @user.errors, status:  :unprocessable_entity }
        end
      end
    end
  
    def update
      respond_to do |format|
        if @user.update(user_params)
          format.html { redirect_to @user, notice: 'User was successfully updated.' }
          format.json { render :show, status: :ok, location: @user }
        else
          format.html { render :edit }
          format.json { render json: @user.errors, status: :unprocessable_entity }
        end
      end
    end
    def destroy
      @user.destroy
      respond_to do |format|
         format.html { redirect_to users_url, notice: 'User was successfully destroyed.' }
        format.json { head :no_content }
      end
    end
  
    private
      def set_user
        @user = User.find(params[:id])
      end
      def signed_in_after_register 
        session[:user_id] = @user.id 
      end
  
      def user_params
        params.require(:user).permit(:name, :password, :password_confirmation, :email, :age, :profile_picture, :post)
      end
  end
  </code></pre>
  
  <p>This is in my posts_controller</p>
  
  <pre><code>class PostsController &lt; ApplicationController
      def index
          @posts = Post.all.order('created_at DESC')
      end
  def new 
      @post = Post.new
  end
  def create 
      @post = @signed_in_user
      @post = Post.new(post_params)
  
      if @post.save 
          redirect_to @post 
      else
          render 'new'
      end
  end
  def show
      @post = Post.find(params[:id])
      @signed_in_user = session[:user_id]
  end
  def edit
      @post = Post.find(params[:id])
  end
  
  def update
      @post = Post.find(params[:id])
  
      if @post.update(params[:post].permit(:body))
          redirect_to @post
      else
          render 'edit'
      end
  end
  def destroy
      @post = Post.find(params[:id])
      @post.destroy
  
      redirect_to posts_path
  end
  
  private
  def post_params
      params.require(:post).permit(:body)
  end
  end
  </code></pre>
  
  <p>This is the profile.html.erb page that I want the signed_in_users most recent post to be returned to</p>
  
  <pre><code>&lt;%- @posts.each do |post| %&gt;
              &lt;div class="post_wrapper"&gt;
                  &lt;h2 class="title"&gt;&lt;%= link_to post.body, post %&gt;&lt;/h2&gt;
                  &lt;p class="date"&gt;&lt;%= post.created_at.strftime("%B, %d, %Y") %&gt; &lt;/p&gt;
              &lt;/div&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>This is in my routes </p>
  
  <pre><code>Rails.application.routes.draw do
  
    root 'welcome#welcome'
  
    get 'login' =&gt; 'sessions#login', :as =&gt; :login 
  
    get 'profile' =&gt; 'users#profile', :as =&gt; :profile
  
    post 'logging/user' =&gt; 'sessions#create'  
  
    get 'logout' =&gt; 'sessions#destroy', :as =&gt; :logout 
  
    get 'about' =&gt; 'about'
  
    resources :users
  
    resources  :posts
  
    get 'index' =&gt; 'posts#index'
  
    get 'register' =&gt; 'users#new', :as =&gt; :register
  </code></pre>
  
  <p>Just to clear the question up a bit more and be very specific, I want it to be exactly like a status post that Facebook offers, You write it, It post, It shows on your profile. That's it, I have no problems with Writing, Posting and it saving. It just doesn't show on the profile page of the user that created it. </p>