Topic: POST not coming through the action

First off - I apologize; I'm a newbie and I'm a sysadmin by trade and I'm learning ruby.

It seems that my "create" action isn't sending the information that I am entering in my "new" view. I have a route called

localhost:3000/zips

I have a view for the new page

<h1>
  Zip Code Eligibility <font color="green">Add Zip Code</font>
</h1>
<p>
  To <span class="hi">ADD</span> a zip code from the local delivery service, please enter the 5 digit zip code (6 in Canada) and click submit.
</p>
<%= form_for @zip do |z| %>
  <p><%= z.label :zip %> <%= z.text_field :zip %> |
     <%= z.label :state %> <%= z.text_field :state %> </p>
  <p><%= z.submit "Add Zip Code" %></p>
<% end %>

This is my zips_copntroller

class ZipsController < ApplicationController

  def index
    @zips = Zip.all
  end

  def show
    @zip = Zip.find(params[:id])
  end

  def new
    @zip = Zip.new
  end

  def create
    @zip = Zip.new(params[:post])

    if @zip.save
      redirect_to zips_path, :notice => "Zipcode was saved sucessfully"
    else
      render "new"
    end

  end

  def edit
  end

  def update
  end

  def destroy
  end

end

Now when I enter "91202' and then 'CA' I click submit...it submits and redirects to the index view

<h1>
  Pick-up/Delivery Eligibility
</h1>
<h3>
Based on U.S. Zipcode, Canadian Postal Code
</h3>
<p class="el">
  To find out if you qualify for 4over&#146;s local delivery service,
  please enter your <nobr>U.S. 5 digit zip code, or</nobr> your 
  <nobr>Canadian 6 character Postal Code,</nobr> then click submit.
<h4>Current Eligible Zip Codes</h4>

<!-- Possible sample code for the display page when I get around to the search function -->
<% @zips.each do |zip| %>
 <!--"link_to" creates a link...first param is what you want to "display"...the second parameter
   is what you want to link to here it's a shortcut called "zip" (which passes the entrie POST and Rails will create the page with it's contents)
 -->
  <p><%= link_to zip.zip, zip %>|<%= zip.state %></p>
  <hr />
<% end %>
<p><%= link_to "Add a New Zip", new_zip_path %></p>

But it doesn't display the zip and state I enterd...it displays this (image attached)

No ZIp Added

Here is the dump of the log...

Started POST "/zips" for 192.168.188.50 at 2013-08-03 12:51:42 -0700
Processing by ZipsController#create as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"wP8eOqMzOjLfLZjmq62EXdO0C59fHyRk3C/Y4b+96mA=", "zip"=>{"zip"=>"91202", "state"=>"CA"}, "commit"=>"Add Zip Code"}
   (0.3ms)  BEGIN
  SQL (0.7ms)  INSERT INTO "zips" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id"  [["created_at", Sat, 03 Aug 2013 19:51:42 UTC +00:00], ["updated_at", Sat, 03 Aug 2013 19:51:42 UTC +00:00]]
   (2.6ms)  COMMIT
Redirected to http://chrish.sbx.4over.com:3000/zips
Completed 302 Found in 8ms (ActiveRecord: 3.6ms)


Started GET "/zips" for 192.168.188.50 at 2013-08-03 12:51:42 -0700
Processing by ZipsController#index as HTML
  Zip Load (0.5ms)  SELECT "zips".* FROM "zips"
  Rendered zips/index.html.erb within layouts/application (2.7ms)
Completed 200 OK in 8ms (Views: 6.5ms | ActiveRecord: 0.5ms)


Started GET "/assets/application.css?body=1" for 192.168.188.50 at 2013-08-03 12:51:42 -0700


Started GET "/assets/zips.css?body=1" for 192.168.188.50 at 2013-08-03 12:51:42 -0700


Started GET "/assets/jquery.js?body=1" for 192.168.188.50 at 2013-08-03 12:51:42 -0700


Started GET "/assets/zips.js?body=1" for 192.168.188.50 at 2013-08-03 12:51:42 -0700


Started GET "/assets/turbolinks.js?body=1" for 192.168.188.50 at 2013-08-03 12:51:42 -0700


Started GET "/assets/jquery_ujs.js?body=1" for 192.168.188.50 at 2013-08-03 12:51:42 -0700


Started GET "/assets/application.js?body=1" for 192.168.188.50 at 2013-08-03 12:51:42 -0700

Any reason why the :post didn't send the POST information?

ANY help would be great!

[freedel@chrish.sbx.4over.com localdel]$ rails --version
Rails 4.0.0
[freedel@chrish.sbx.4over.com localdel]$ ruby --version
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]

--Christian

Last edited by custangro (2013-08-03 16:07:46)