Thufir,
When you define your models and associations between them, you can
override the defaults that Rails uses. Rails adopts the Convention
over Configuration paradigm, but also includes all the configuration
hooks you''d need.
So, for example, the convention is that the primary key is a field
called "id" and is autogenerated. Instead, you''d tell the
fof_feed
model to use "feed_id" as the id.
# class FofFeed < ActiveRecord::Base
# set_primary_key "feed_id"
# end
#
# # You still use the id method to access this value
# f = FofFeed.create
# f.id
If you look at the API docs for ActiveRecord::Base you''ll find these
configuration options.
That should get you started. :-)
-Danimal
On Apr 9, 3:28 am, thufir
<hawat.thu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> what''s the first step for the migration of a legacy db such as:
>
> mysql>
> mysql> SHOW TABLES;
> +-------------------------+
> | Tables_in_feed_on_feeds |
> +-------------------------+
> | fof_feed |
> | fof_item |
> | fof_item_tag |
> | fof_subscription |
> | fof_tag |
> | fof_user |
> +-------------------------+
> 6 rows in set (0.00 sec)
>
> mysql>
> mysql> DESCRIBE fof_feed;
> +-------------------------+---------+------+-----+---------
> +----------------+
> | Field | Type | Null | Key | Default |
> Extra |
> +-------------------------+---------+------+-----+---------
> +----------------+
> | feed_id | int(11) | NO | PRI | NULL |
> auto_increment |
> | feed_url | text | NO | |
> | |
> | feed_title | text | NO | |
> | |
> | feed_link | text | NO | |
> | |
> | feed_description | text | NO | |
> | |
> | feed_image | text | YES | | NULL
> | |
> | feed_image_cache_date | int(11) | YES | | 0
> | |
> | feed_cache_date | int(11) | YES | | 0
> | |
> | feed_cache_attempt_date | int(11) | YES | | 0
> | |
> | feed_cache | text | YES | | NULL
> | |
> +-------------------------+---------+------+-----+---------
> +----------------+
> 10 rows in set (0.00 sec)
>
> mysql>
> mysql>
>
> thanks,
>
> Thufir
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---