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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CALDHwN4iGikJhFk__8zbVe%3Ds-EWho-VXUE7vwvFbKZeak%2BdnXQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedMay 10, '16 at 8:24p
activeMay 10, '16 at 8:24p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Deepak Sharma: 1 post

People

Translate

site design / logo © 2021 Grokbase