ok lets speak some code snippet
##################
version 1 start
class Advertiser < ActiveRecord::Base
set_table_name “INSERENT”
set_primary_key “INSNR”
has_many :priv_properties,
:class_name => “PrivProperty”,
:foreign_key => “MAKNR”
end
ruby script/console:
ins = Advertiser.find(100050)
… display resultset
ins.id
=> nil
ins.priv_properties
=> []
ins.priv_properties produces the follow sql statement
SELECT * FROM OBJPRIV WHERE (OBJPRIV.MAKNR = NULL)
so ins.id is a NilClass and the quote method returns NULL
ende
##################
##################
version 2 start
class Advertiser < ActiveRecord::Base
set_table_name “INSERENT”
set_primary_key :insnr
has_many :priv_properties,
:class_name => “PrivProperty”,
:foreign_key => “MAKNR”
end
ruby script/console:
ins = Advertiser.find(100050)
… display resultset
ins.id
=> #BigDecimal:3fd2c8c,‘0.10005E6’,8(12)
ins.priv_properties
=> []
ins.priv_properties produces the follow sql statement
SELECT * FROM OBJPRIV WHERE (OBJPRIV.MAKNR = 100050.0)
so ins.id returns the bigdecimal and the sql statement will be filled
with the right value in the condition area
the only thing i changed, was the options under set_primary_key from
string “INSNR” to a hash :insnr
(is it the right spelling?)
ende
##################
the next problem is the bigdecimal typed id
standard rails created database schematas will return only the value
of id without any kind of
type information and so on
in this case, the id is mapped to “INSNR” of my legacy table and that
produces => #BigDecimal:3fd2c8c,‘0.10005E6’,8(12)
its okay, but the foreign_key is a char(10) so its a difference
between 100050 100050.0
for an integer column its no difference but it isnt proper for my
eyes 
so for the current integration of the legacy tables, the bigdecimal
column should be a clear integer …
ins.id.to_i returns the right value for the condition
additionally, if i scaffold the INSERENT table the ids also are
floating point numbers
why?
many thanks to you
best regards