I write an application for medical physics in Rails (for many reasons) and I have a problem, now. I have a five tables: create_table "plans", :force => true do |t| t.column "treatment_id", :integer t.column "technics", :string t.column "number_of_beams", :integer, :limit => 2 t.column "calculation", :string t.column "dose_max", :integer, :limit => 4 t.column "dose_mean", :integer, :limit => 4 t.column "mlc", :boolean t.column "sad", :boolean t.column "ssd", :boolean end create_table "structure_values", :id => false, :force => true do |t| t.column "plan_id", :integer t.column "structure_id", :integer t.column "value_max", :integer, :limit => 4 t.column "value_mean", :integer, :limit => 4 end add_index "structure_values", ["plan_id"], :name => "structure_values_plan_id_index" add_index "structure_values", ["structure_id"], :name => "structure_values_structure_id_index" create_table "structures", :force => true do |t| t.column "name", :string t.column "dose", :text end create_table "treatments", :force => true do |t| t.column "describe_of_strategy", :string, :limit => 100 t.column "detail_describe", :text t.column "aims_volumes", :string, :limit => 100 t.column "day_dose", :integer, :limit => 3 t.column "number_of_fractions", :integer, :limit => 2 t.column "equiv_std_fraction", :integer, :limit => 4 t.column "schield", :boolean t.column "kind_of_rays", :string, :limit => 1 t.column "energy_of_rays", :integer, :limit => 2 t.column "prescription_id", :integer t.column "machine_id", :integer t.column "created_on", :datetime t.column "updated_on", :datetime end create_table "treatments_structures", :id => false, :force => true do |t| t.column "treatment_id", :integer t.column "structure_id", :integer end add_index "treatments_structures", ["treatment_id"], :name => "treatments_structures_treatment_id_index" add_index "treatments_structures", ["structure_id"], :name => "treatments_structures_structure_id_index" OK. I have written model and controller for (right) working with tables Treatment, Treatment_Structures and Structures. And now I need to work with tables Plans and Structure_Values with right relationship. Can anybody help me with this problem: I don''t know, how I can do right associations with Plan and Structure_Values? Plan :has_many Structure_Values and I need set to this table right ID number for Structures (from table Structures). I must to solve this problem, without it I can''t continue in my work. Thanks. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---