Why are listings not saved in category?

Hello everyone,

I'm currently working on the functionality that users can create
listings that are than saved in categories. I created tables and
relationships but I cannot get the listings do be saved in the
Here is what I have:

Model category.rb

class Category < ActiveRecord::Base
  has_many :listings

model listing.rb
class Listing < ActiveRecord::Base
  belongs_to :user
  belongs_to :category
  default_scope -> { order('created_at DESC') }
  validates :location, presence: true, length: { maximum: 20 }
  validates :title, presence: true, length: { maximum: 20 }
  validates :user_id, presence: true
  validates :description, presence: true


Listings controller
def new
      @listing = Listing.new
      @listings = Listing.paginate(page: params[:page])
      @categories = Category.all

def create
    @listing = current_user.listings.build(listing_params)
    @categories = Category.all
    if @listing.save
      flash[:success] = "Job Post created"
      redirect_to current_user
        render 'listings/new'

Views categories/new
<h1>New category</h1>

<%= render 'form' %>

<%= link_to 'Back', categories_path %>

Views categories/_form.html.erb
<%= form_for(@category) do |f| %>
  <% if @category.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@category.errors.count, "error") %> prohibited
this category from being saved:</h2>

      <% @category.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
  <% end %>

  <div class="field">
    <%= f.label :name %><br>
    <%= f.text_field :name %>
  <div class="actions">
    <%= f.submit %>
<% end %>

Views Listing/new.html.erb

<div class="top">
<%= form_for(@listing) do |f| %>
<%= render 'shared/error_messages', object: f.object %>

<h1> Create Job Post </h1>
<div class=" form row">
  <div class="span6 offset3 ">

    <%= f.label :title %>
    <%= f.text_field :title %>

    <%= f.label :location %>
    <%= f.text_field :location %>

      <%= f.text_area :description, placeholder: "Compose new
listing...", class: "description_form" %>

  <select name="listing[category_id]">
   <% @categories.each do |category| %>
       <option value="<%= category.id %>"
         <%= ' selected' if category.id == @listing.category_id %>>
         <%= category.name %>
   <% end %>


<div class="space-button-form">
  <%= f.submit "Post", class: "tfbutton tfbutton-search
tfbutton-sign-up post" %>

<% end %>

I have a listings table with the following columns:
id title description location user_id created_at updated_at category_id

and categories table
id name created_at updated_at

When I create a new listing and than check the listings table, the
category_id field is blank.
Does anyone know why my listings are not saved in the categories?

Thank you very much