Im new to the world of ruby, im currently designing a small clinical information app using ruby, i have designed my tables and relationships by hand but im having some trouble passing it to the rails world, can someone give me a help please?
id_number:string, id_type:string, name:string, common_name:string, address:string, tax_number:string, birth_date:string, sex:string, mobile_phone:string, home_phone:string, work_phone:string, email:string
Patient has_one :postal, has_one :entity, has_one :profession
Postal has_and_belongs_to_many :patients
Entities belongs_to :patient
Profession has_and_belongs_to_many :patients
Once again many thanks
Rails by default expects there to be an id field in every table (except has_and_belongs_to_many join tables). It uses the id field to set up the relationships. You can over-ride this behaviour by defining foreign_key and primary_key in your belongs_to or has_many declarations. However, it is usually easier to just use ids.
The id should be a self-incrementing integer field.
The Rails App explains what is required reasonably well: