Yep. Do something like this:
class XXX < ActiveRecord::Base
has_many :persons, :class_name => "Person", :foreign_key =>
"person_id"
def self.table_name() "YYY" end
def self.primary_key()
"myprimarykey_id"
end
End
So, you can tell active record what the primary key is for each model, and
you can spell out what foreign keys to use for has_many and belongs_to,
etc., as well as what the table name is.
Dave
On 3/31/05 11:46 AM, "Ben Protas"
<ben-JUzxsTXROvqakBO8gow8eQ@public.gmane.org> wrote:
> Railers:
>
> I''m new to Rails, converting some PHP apps to it. Can anyone
provide
> some pointers on where to find info for dealing with legacy database
> schemas? Specifically, I have several tables that, for example, use
> person_id as a primary key, which is a foreign key to another table,
> but don''t have their own "id" field - will this still
work with
> ActiveRecord?
>
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>