You don''t create models from an existing schema... you create models
that
map to existing tables :) But I''ll stop splitting hairs.
ruby script/generate model users --skip-migration
Or just create a new class for the table manually
in app/models/user.rb
class User < ActiveRecord::Base
end
As long as your table name is pluralized and you have a primary key column
called ''id'' it will just work. If you don''t, you can
specify the table name
and primary key name
class User < ActiveRecord::Base
set_primary_key :person_id
set_table_name :person
end
On Tue, Feb 26, 2008 at 12:15 AM, jim starboard
<jim.starboard-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:
>
> How do I automatically create model classes from an existing db
> schema? this is in RoR 2.0
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---