title: Spree PG::NotNullViolation: ERROR
body: <p>I'm using Spree on my Ruby on Rails app, and I'm having the following error</p>
  
  <pre><code>ActiveRecord::StatementInvalid in Spree::Admin::ProductsController#create
  
  PG::NotNullViolation: ERROR: null value in column "name" violates not-null constraint DETAIL: Failing row contains (12, null, null, null, null, null, null, null, null, 1, 2018-05-15 08:58:58.830082, 2018-05-15 08:58:58.830082, t, null, null). : INSERT INTO "spree_products" ("name", "shipping_category_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"
  
   log(sql, name, type_casted_binds, stmt_key) do
          @connection.exec_prepared(stmt_key, type_casted_binds.map { |_, val| val })
        end
      rescue ActiveRecord::StatementInvalid =&gt; e
        pgerror = e.original_exception
  </code></pre>
  
  <p>Now I'm not sure what is causing this problem or how to solve it.</p>
  
  <p>I'm assuming it's got to do with the <code>spree_globalize</code> gem. 
  I've tried to uninstall the gem but then I get the error backend missing <code>spree_globalize</code></p>
  
  <p>Anyone know how to solve this problem?</p>
  
  <p><strong>This is the log file:</strong></p>
  
  <pre><code>Started POST "/store/admin/products" for 213.127.86.174 at 2018-05-15 08:58:58 +0000
  
  Cannot render console from 213.127.86.174! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
  
  Processing by Spree::Admin::ProductsController#create as HTML
    Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"v==", "product"=&gt;{"name"=&gt;"Volks", "sku"=&gt;"", "prototype_id"=&gt;"", "price"=&gt;"29", "available_on"=&gt;"", "shipping_category_id"=&gt;"1"}, "button"=&gt;""}
    Spree::Preference Load (0.5ms)  SELECT  "spree_preferences".* FROM "spree_preferences" WHERE "spree_preferences"."key" = $1 LIMIT 1  [["key", "spree/backend_configuration/locale"]]
    Spree::User Load (0.7ms)  SELECT  "spree_users".* FROM "spree_users" WHERE "spree_users"."deleted_at" IS NULL AND "spree_users"."id" = $1  ORDER BY "spree_users"."id" ASC LIMIT 1  [["id", 1]]
    Spree::Role Load (0.8ms)  SELECT "spree_roles".* FROM "spree_roles" INNER JOIN "spree_role_users" ON "spree_roles"."id" = "spree_role_users"."role_id" WHERE "spree_role_users"."user_id" = $1  [["user_id", 1]]
     (0.3ms)  BEGIN
  
    Spree::Product Exists (2.0ms)  SELECT  1 AS one FROM "spree_products" INNER JOIN "friendly_id_slugs" ON "friendly_id_slugs"."sluggable_id" = "spree_products"."id" AND "friendly_id_slugs"."deleted_at" IS NULL AND "friendly_id_slugs"."sluggable_type" = $1 WHERE ("spree_products"."id" IS NOT NULL) AND "spree_products"."slug" = 'volks' LIMIT 1  [["sluggable_type", "Spree::Product"]]
  
  Spree::Product Exists (0.6ms)  SELECT  1 AS one FROM "spree_products" INNER JOIN "friendly_id_slugs" ON "friendly_id_slugs"."sluggable_id" = "spree_products"."id" AND "friendly_id_slugs"."deleted_at" IS NULL AND "friendly_id_slugs"."sluggable_type" = $1 WHERE ("spree_products"."id" IS NOT NULL) AND "spree_products"."slug" = 'volks' LIMIT 1  [["sluggable_type", "Spree::Product"]]
  
  Spree::ShippingCategory Load (0.5ms)  SELECT  "spree_shipping_categories".* FROM "spree_shipping_categories" WHERE "spree_shipping_categories"."id" = $1 LIMIT 1  [["id", 1]]
  
  Spree::Product::Translation Load (1.7ms)  SELECT DISTINCT locale FROM "spree_product_translations"  ORDER BY "spree_product_translations"."locale" ASC
  
  Spree::Product Exists (0.8ms)  SELECT  DISTINCT 1 AS one FROM "spree_products" INNER JOIN "spree_product_translations" ON "spree_product_translations"."spree_product_id" = "spree_products"."id" WHERE 1=0 AND ("spree_product_translations"."slug" = 'volks-f405f8ca-e79d-4bbb-ba8a-63f80a13318a' AND "spree_product_translations"."deleted_at" IS NULL AND "spree_product_translations"."locale" = 'en') LIMIT 1
                SQL (1.7ms)  INSERT INTO "spree_products" ("name", "shipping_category_id", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "id"  [[nil, nil], ["shipping_category_id", 1], ["created_at", "2018-05-15 08:58:58.830082"], ["updated_at", "2018-05-15 08:58:58.830082"]]
                 (0.2ms)  ROLLBACK
              Completed 500 Internal Server Error in 49ms (ActiveRecord: 9.7ms)
  </code></pre>
  
  <p><strong>Gemfile</strong></p>
  
  <pre><code>source 'https://rubygems.org
  
  
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
  gem 'rails', '4.2.6'
  # Use sqlite3 as the database for Active Record
  # gem 'sqlite3'
  gem 'pg', '&lt; 1'
  # Use SCSS for stylesheets
  gem 'sass-rails', '~&gt; 5.0'
  # Use Uglifier as compressor for JavaScript assets
  gem 'uglifier', '&gt;= 1.3.0'
  # Use CoffeeScript for .coffee assets and views
  gem 'coffee-rails', '~&gt; 4.1.0'
  # See https://github.com/rails/execjs#readme for more supported runtimes
  gem 'therubyracer', platforms: :ruby
  
  # Use jquery as the JavaScript library
  gem 'jquery-rails'
  # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
  gem 'turbolinks'
  # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
  gem 'jbuilder', '~&gt; 2.0'
  # bundle exec rake doc:rails generates the API under doc/api.
  gem 'sdoc', '~&gt; 0.4.0', group: :doc
  
  gem 'rake'
  gem 'rspec'
  gem 'kramdown'
  gem 'thor', '0.19.1'
  gem 'spree_braintree_vzero', github: 'spree-contrib/spree_braintree_vzero'
  # Use ActiveModel has_secure_password
  # gem 'bcrypt', '~&gt; 3.1.7'
  
  # Use Unicorn as the app server
  # gem 'unicorn'
  
  # Use Capistrano for deployment
  # gem 'capistrano-rails', group: :development
  
  
  group :development, :test do
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console
    gem 'byebug'
    gem 'capistrano-passenger'
    gem 'capistrano-rails'
    gem 'capistrano-rvm'
  
  end
  
  group :development do
  
    # Access an IRB console on exception pages or by using &lt;%= console %&gt; in views
    gem 'web-console', '~&gt; 2.0'
  
    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
    gem 'spring'
  end
  
  gem 'spree', '~&gt; 3.1.0.rc1'
  gem 'spree_auth_devise', '~&gt; 3.1.0.rc1'
  gem 'spree_gateway', '~&gt; 3.1.0.rc1'
  gem 'devise'
  gem 'materialize-sass'
  gem 'active_link_to'
  gem 'mollie-api-ruby', '&lt; 3.2'
  # gem 'spree_mollie', github: 'salman15/mollie_spree_2017', branch: 'stable'
  gem 'spree_mollie', github: 'ttcremers/spree_mollie', branch: 'stable'
  gem 'spree_mail_settings', github: 'spree-contrib/spree_mail_settings'
  gem 'spree_i18n', github: 'spree-contrib/spree_i18n'
  gem 'spree_globalize', github: 'spree-contrib/spree_globalize', branch: 'master'
  gem "mini_magick"
  # gem 'rails-i18n', github: 'svenfuchs/rails-i18n', branch: 'rails-4-x' # For 4.x
  # gem 'globalize', '~&gt; 5.1.0'
  </code></pre>