Hello,
I have two tables “people” and “relations”
Following are the models
class Person < ActiveRecord::Base
has_and_belongs_to_many :relations
class Relation < ActiveRecord::Base
has_and_belongs_to_many :people
I want to select multiple relations and when i say
Person.create(params[:person]) in controller
the relation ids and and id of person should be stored in
people_relation table.
Here is the form for person.
<%form_for (:person,:url=>{:action =>“create”},:html => { :multipart =>
true })do |p|%>
Relation:
<%=p.select(“id”,Relation.find(:all).collect{|rel|[rel.relation_name,rel.id]},
{:prompt=>"-Select a Relation"},{:multiple=>true})%>
<%end%>
Please tell me what do i need to do
Thank you