Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7701949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:06:54+00:00 2026-05-31T23:06:54+00:00

I am working on my app (Rails 3.2, PostgreSQL 9.1) on localhost and everything

  • 0

I am working on my app (Rails 3.2, PostgreSQL 9.1) on localhost and everything works me well there, so I decided to deploy the app to the production to Heroku.

After successful deployment of the app I tried to create a new item and got this error message:

ActiveRecord::StatementInvalid (PG::Error: ERROR:  null value in column "persistence_token" violates not-null constraint

It’s about the table Users (use Authlogic gem). This is the sample of migration – critical part:

class CreateUsers < ActiveRecord::Migration
  def self.up
     create_table :users do |t|
       t.string    :name,                :null => false   
       t.string    :email,               :null => false                                           
       t.string    :crypted_password,    :default => nil, :null => true             
       t.string    :password_salt,       :default => nil, :null => true          
       t.string    :email,               :default => nil, :null => true          
       t.string    :persistence_token,   :null => false      
       t.string    :single_access_token, :null => false              
       t.string    :perishable_token,    :null => false            
       t.datetime  :last_request_at                                    
       t.datetime  :current_login_at                                   
       t.datetime  :last_login_at                                      
       t.string    :current_login_ip                                   
       t.string    :last_login_ip                                      

       t.timestamps
     end
   end
end

What could caused this problem? I mean, I see in the migration is the rule :null => false and the error message says about the null value saved into this column, but how is possible on localhost this work well and on Heroku not?

And, how could I fix that? My first idea was to create a new migration, where I set up for that column :null => true, but is it correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:06:55+00:00Added an answer on May 31, 2026 at 11:06 pm

    I set up the default value to DEFAULT '' and the error is gone…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did heroku create and pushed a working rails app to the server. Everything
I'm trying to get Redmine (a Ruby on Rails app) working. It works fine
I'm working on Rails app with Paperclip gem used to save users' avatars. Production
I'm working on a Ruby on Rails/PostgreSQL web app that a mobile device communicates
I have been working to deploy a relatively large Rails app (Rails 2.3.5) and
I've upgraded an app to Rails 3.1, and everything is setup and working correctly
A rails app I'm working on features examples of quadratic equations. Obviously, these are
I have rails app which are working perfectly in the local computer. But when
I'm working on a Rails app and am looking to include some functionality from
So I'm working on a Rails app to get the feeling for the whole

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.