Activerecord generating wrong syntax with postgresql

I’m using activerecord outside of rails and find_first generates sql
that postgresql doesnt’ like. This is rails 1.1.4, with everything up
to date via “gem update”.

This is the command line:

ruby -rrubygems seca -c …/etc/seca.cnf cert --export 1 --format
pkcs12 --key root.key >root.pfx

This is the error:

(PGError: ERROR: argument of WHERE must be type boolean, not type
integer
: SELECT * FROM certificates WHERE (1) LIMIT 1)

This is the code that generates the error:

bc = SECA::Backend::Certificate.find_first(options[:certificate_id])

If I change it to this, it works:

bc = SECA::Backend::Certificate.find(:first, :conditions => [“id = ?”,
options[:certificate_id]])

And this is the model:
module SECA
module Backend
class Certificate < ActiveRecord::Base
STATUS_VALID = 0
STATUS_REVOKED = 1
STATUS_EXPIRED = 2
has_one :data, :class_name => ‘CertificateData’,
:foreign_key => ‘certificate_id’, :dependent => true
#has_one :serial, :class_name => ‘Serial’, :dependent => true,
# :foreign_key => ‘issuer_id’
# User :finder_sql to find revoked, valid, etc
has_many :revoked_certificates, :class_name => ‘Certificate’,
:finder_sql => 'SELECT * FROM certificates WHERE ’ +
'STATUS = ’ + STATUS_REVOKED.to_s
has_many :valid_certificates, :class_name => ‘Certificate’,
:finder_sql => 'SELECT * FROM certificates WHERE ’ +
'STATUS = ’ + STATUS_VALID.to_s
has_many :certificates, :class_name => ‘Certificate’,
:foreign_key => ‘issuer_id’
has_many :current_crl, :class_name => ‘CRL’,
:finder_sql => 'SELECT id, issuer_id, last_update,
MAX(next_update) ’ +
‘AS next_update FROM crls GROUP BY id’

end

end
end