module ActiveRecord::AttributeMethods::PrimaryKey::ClassMethods

def primary_key=(value)

Project.primary_key # => "foo_id"

end
end
'foo_' + super
def self.primary_key
class Project < ActiveRecord::Base

You can also define the #primary_key method yourself:

end
self.primary_key = 'sysid'
class Project < ActiveRecord::Base

Sets the name of the primary key column.
def primary_key=(value)
  @primary_key        = value && -value.to_s
  @quoted_primary_key = nil
  @attributes_builder = nil
end