title: How to insert primary key value explicitly?
body: <p>I have a table called <em>messages</em> and here is the table structure,  I don’t want <em>id</em> is auto increment field but it should be a primary key for that table.</p>
  
  <p>Here is table structure for <em>messages</em></p>
  
  <pre><code>CREATE TABLE `messages` (
        `id` INT(11) NOT NULL,
        `user_id` INT(11) NOT NULL,
        `text` VARCHAR(255) NOT NULL,
        `source` VARCHAR(100),
        `created_at` DATETIME DEFAULT NULL,
        `updated_at` DATETIME DEFAULT NULL,
        PRIMARY KEY (`id`)
      );
  </code></pre>
  
  <p>while insert the data into table I am using below hash object</p>
  
  <pre><code>msg['id'] = 12345; 
  msg['user_id'] = 1;
  msg['text'] = 'Hello world';
  </code></pre>
  
  <p>If I save this hash into messages table, id is not inserting</p>
  
  <pre><code>message = Message.new(msg);
  message.save!
  </code></pre>
  
  <p>Rails is building insert sql with out <em>id</em>, so <em>id</em> value is not inserting messages table. </p>
  
  <p>How insert the id value in table, This the insert sql rails build with out using <em>id</em> field</p>
  
  <pre><code>INSERT INTO `users` (`updated_at`, `user_id `, `text`, `created_at`) VALUES('2010-06-18 12:01:05', '1', 'Hello world', '2010-06-18 12:01:05');
  </code></pre>