Create Problem Error

Bonjour,
J’ai un petit soucis avec la méthode create

ZonesGraphique.create(:Libelle => “Ain”)
=> #<ZonesGraphique:0x22079f4 @new_record=false, @attributes=
{“Libelle”=>“Ain”, “CodePays”=>nil, “CodeZone”=>nil,
“IDZoneGeographique”=>1}, @errors=#<ActiveRecord::Errors:0x127cce0
@base=#<ZonesGraphique:0x22079f4 …>, @errors={}>>

ZonesGraphique.new
=> #<ZonesGraphique:0x2589410 @new_record=true, @attributes=
{“Libelle”=>nil, “CodePays”=>nil, “CodeZone”=>nil}>

à chaque fois j’ai une error = false Cependant quand j’utlise la
méthode new et save ensuite ca fonctionne correctement

:frowning:

ma bdd
create_table :Expay_Distributeurs, :id => false, :primary_key =>
‘IDDistributeur’ do |t|
t.column :IDDistributeur, :integer
t.column :codeDistributeur, :integer
t.column :RaisonSociale, :string
t.column :AdresseL1, :string
t.column :AdresseL2, :string
t.column :longitude, :float
t.column :Latitude, :float
t.column :iDCodePostal, :integer
t.column :iDZoneGeographique, :integer
end

mon model

class ZonesGraphique < ActiveRecord::Base

set_table_name “Expay_ZonesGraphiques”
set_primary_key “IDZoneGeographique”

has_many :distributeurs

belongs_to :pay, :class_name => “Pay”, :foreign_key => “CodePays”
end

Merci

Bolo M.
[email protected]
http://blog.developpez.com/index.php?blog=30