Help in seeding and logic for my application

In my application I have to tables

  1. Student
  2. Alma Mater Department

Student table belongs_to :alma_mater_department and Alma Mater
Department has_many :students

Firstly, I want to predefined some data in seeds.rb for Alma Mater
table which I want to look like this

++++++++++++++++++++

  • Type | Name +
    ++++++++++++++++++++
  • B.Tech | Mechanical +
  •          |   Production  +
    
  •          |   Electronics  +
    

++++++++++++++++++++

  • M.Tech | Mechanical +
  •          |   Production   +
    
  •          |   Electronics  +
    

++++++++++++++++++++

What is the best approach of doing this kind of seeding (as it has
many repeating values)

Secondly, once done with above step, I want that under student’s
new.html.erb there will be two <collection_select> fields

  1. Where user can choose from Type
  2. Where user can choose from Name

Say, user choose value == B.Tech Production (which according to table
is id=2). How to send that id thing in Student table and display them.

P.S: My problem is bit topsy turvy kinda thing. Please bear with me as
I am leaning these concepts.


Cheers!

Deepak Kumar Sharma
Guru Nanak Dev Engineering College
India!

Blog: http://deekysharma.wordpress.com