title: HTTP status code 302
body: <p>Im working on my Rails Backend in Ruby and i want to post Data to this server. But if i do a Post-request with PAW i get redirected. Im a newbie to Http Requests. Could someone explain me the functionality and how to use http post requests? </p>
  
  <p>i want to post information on my server's datanase (sqlite3).</p>
  
  <p>Here's a screenshot which should explain everything:
  <a href="https://i.stack.imgur.com/2l0qo.png" rel="noreferrer"><img src="https://i.stack.imgur.com/2l0qo.png" alt="i hope thats all information you need"></a></p>
  
  <p>how does this work? please explain :)
  thanks.
  greetings John</p>
  
  <p>and here's the code:</p>
  
  <p>OwnersController:</p>
  
  <pre><code>#app/controllers/owners_controller.rb
  class OwnersController &lt; SessionsController
       respond_to :html
       before_action :owner_find, only: [:show, :edit, :update, :destroy]
  
       def index
          @owners = Owner.all
       end
  
       def show
       end  
  
      def update
         @owner = Owner.find(params[:id])
  
         if @owner.update(owner_params)
            redirect_to @owner
         else
            render 'edit'
         end
      end
  
      def new
         @owner = Owner.new
      end
  
      def destroy 
         @owner.destroy
         redirect_to owners_path
      end
  
      def edit
      end
  
      def create
          @owner = Owner.new owner_params
          if @owner.save!
             flash[:notice] = 'You signed up successfully'
             flash[:color]= 'valid'
             redirect_to owners_path
          else
             flash[:notice] = 'Form is invalid'
             flash[:color]= 'invalid'
            render 'new'
          end
      end
  
    private 
  
    def owner_find 
       @owner = Owner.find(params[:id])
    end  
  
    def owner_params
       params.require(:owner).permit(:name, :password, :password_confirmation, :token)
    end
  end
  </code></pre>
  
  <p>SessionController:</p>
  
  <pre><code>class SessionsController &lt; ApplicationController
    before_filter :authenticate_user, :except =&gt; [:login, :login_attempt]
  
    def login
      #goes to Login Form
    end
  
    def logout
      session[:owner_id] = nil
      redirect_to :action =&gt; 'login'
    end
  
    def login_attempt
      authorized_user = Owner.authenticate_by_name(params[:login_name],params[:login_password])
      if authorized_user
        session[:owner_id] = authorized_user.id
        flash[:notice] = "Wow Welcome again, you logged in as #{authorized_user.name}"
        redirect_to welcome_index_path
      else
        flash[:notice] = 'Invalid Username or Password'
        flash[:color]= 'invalid'
        render 'login'
      end
    end
  end
  </code></pre>
  
  <p>Console Logs:</p>
  
  <p>from web-request (<a href="http://192.168.2.144:3000/owners?name=hans&amp;password=hans321&amp;password_confirmation=hans321" rel="noreferrer">http://192.168.2.144:3000/owners?name=hans&amp;password=hans321&amp;password_confirmation=hans321</a>)</p>
  
  <blockquote>
    <p>Started GET "/owners?name=hans&amp;password=[FILTERED]&amp;password_confirmation=[FILTERED]" for 192.168.2.144 at 2015-10-01 12:12:18 +0200
    Cannot render console from 192.168.2.144! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
    Processing by OwnersController#index as HTML
      Parameters: {"name"=>"hans", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}
      Owner Load (0.1ms)  SELECT  "owners".* FROM "owners" WHERE "owners"."id" = ? LIMIT 1  [["id", 2]]
      Owner Load (0.1ms)  SELECT "owners".* FROM "owners"
      Rendered owners/index.html.erb within layouts/application (1.8ms)
    Completed 200 OK in 60ms (Views: 58.9ms | ActiveRecord: 0.2ms)</p>
  </blockquote>
  
  <p>It's telling 200 ok but nothing happens in the DB.</p>
  
  <p>from Paw-Request (so i can use post. btw. how do i use post in browser request?</p>
  
  <blockquote>
    <p>Started POST
    "/owners?name=hans&amp;password=[FILTERED]&amp;password_confirmation=[FILTERED]"
    for 192.168.2.144 at 2015-10-01 12:12:45 +0200 Cannot render console
    from 192.168.2.144! Allowed networks: 127.0.0.1, ::1,
    127.0.0.0/127.255.255.255 Processing by OwnersController#create as HTML   Parameters: {"name"=>"hans", "password"=>"[FILTERED]",
    "password_confirmation"=>"[FILTERED]"} Can't verify CSRF token
    authenticity Redirected to <a href="http://192.168.2.144:3000/" rel="noreferrer">http://192.168.2.144:3000/</a> Filter chain
    halted as :authenticate_user rendered or redirected Completed 302
    Found in 1ms (ActiveRecord: 0.0ms)</p>
  </blockquote>
  
  <p>It seems that the CRSF authentication failed..</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>at first: 
  to Rich Peck! This helped me so much. Thank you!! I really appreciate your effort.</p>
  
  <p>Im near to the solution.. My problem is: i cant put the correct params in the url. The token-auth is disabled for testing. so it wont matter.</p>
  
  <p>the params should be like:
   Parameters: {"utf8"=>"✓", "authenticity_token"=>"q9JvFhoSUgfydFTvh18JHbIIdKNDjnOS9m/trVBu9EHPP04xGsO69zPh1BFZBI1Ev1YcnOTiPmaAiPWOSkm5Xg==", "owner"=>{"name"=>"Hubert", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"Create Owner"}</p>
  
  <p>and not as in my request:
  Parameters: {"name"=>"Hubert", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "owner"=>{}}</p>