title: Rails: PG::NotNullViolation: ERROR: null value in column "id" violates not-null constraint
body: <p>Here is the error when saving a record into postgres database on rails 3.2.12 &amp; pg 9.3:</p>
  
  <pre><code>ActiveRecord::StatementInvalid (PG::NotNullViolation: ERROR:  null value in column "id" violates not-null constraint
  : INSERT INTO "sw_module_infox_module_infos" ("about_controller", "about_init", "about_log", "about_misc_def", "about_model", "about_onboard_data", "about_subaction", "about_view", "about_workflow", "active", "api_spec", "category_id", "created_at", "last_updated_by_id", "module_desp", "name", "submit_date", "submitted_by_id", "updated_at", "version", "wf_state") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING "id"):
    activerecord (3.2.12) lib/active_record/connection_adapters/postgresql_adapter.rb:1166:in `get_last_result'
    activerecord (3.2.12) lib/active_record/connection_adapters/postgresql_adapter.rb:1166:in `exec_cache'
  </code></pre>
  
  <p>The table was working fine until now (saved about 50 records before the error today). After opening the pg table in pgadmin. we found the <code>id</code> on the table is <code>integer</code>. We also found <code>Id</code> on other table is <code>serial</code>. It seems that the id should be <code>serial</code> so it can auto-increment. If it is, then how to convert a id column to <code>serial</code> from <code>integer</code>? If it is not, then how to fix this problem?  </p>