title: ruby datamapper can't save to database
body: <p>I have a database schema like that</p>
  
  <pre><code>DataMapper.setup :default, "sqlite://#{Dir.pwd}/image.db"
  class Image
      include DataMapper::Resource
  
      property :id       , Serial
      property :url , String,unique: true
      property :desc    , String,unique: true,default: "empty"
  end
  DataMapper.finalize.auto_upgrade!
  </code></pre>
  
  <p>Then i have a loop like this</p>
  
  <pre><code>links.each do |link|
    puts link
    if Image.all(:url=&gt;link).empty? == true
      img=Image.create(:url =&gt; link)
      puts "Cannot save to database "if img.saved? == false
    end
  end
  </code></pre>
  
  <p>I want to add a link when it is not already in a database. I run the script and always get cannot save to dabase. What am I doing wrong? Thanks for any help.
  Edit: I add to my code</p>
  
  <pre><code>DataMapper::Logger.new($stdout, :debug)
  </code></pre>
  
  <p>and there was no insert queries only selects. </p>