title: Rails 4 ActiveRecords: Save multiple records at once with validation
body: <p>Hi i have the following situation. I can save this array of hashes  </p>
  
  <pre><code>products = [{
     :name=&gt; 0,
     :key  =&gt; 12345,
     :label =&gt; "test1",
    },{
     :name=&gt; 0,
     :key  =&gt; 12145,
     :label =&gt; "test",    
    }]
  </code></pre>
  
  <p>at once with </p>
  
  <pre><code>products.map {|p| Product.new(p).save }  
  </code></pre>
  
  <p>or </p>
  
  <pre><code>Product.create(products)
  Product.create!(products)
  </code></pre>
  
  <p>but the all my uniqueness validations like</p>
  
  <pre><code>validates :key, presence: true, uniqueness: true
  </code></pre>
  
  <p>are ignored, using the rails console. I am able to save this hash multiple times. Does anyone has some advice? Thanks in advance!</p>
  
  <p><strong>SOLUTION</strong></p>
  
  <p>As simple as restarting my rails console. After that my logs look like the logs from @Akadisoft. </p>
  
  <p>Also using this way:</p>
  
  <pre><code>products.map {|p| Product.new(p).save } 
  </code></pre>
  
  <p>which return an array with booleans <code>[false,true]</code> either the record was saved or not, which is nice for further evaluation.</p>