Hi,
I am using the fields_for and am getting a problem of
“undefined local variable or method `organisation’ for
#<#Class:0x4775534:0x477550c>”
my person model is as
class Person < ActiveRecord::Base
has_and_belongs_to_many :organisations
My Organisation model is as
class Organisation < ActiveRecord::Base
has_and_belongs_to_many :people
Please help me with this. I was following the railscasts complex forms2
74
This is the code for form to create a new person and simultaneously
create an organisation for that person.
<%form_for :person,:url=>{:action =>“submit_tag”} do |p|%>
<%=submit_tag ‘CREATE INDIVIDUAL’, :name=>“submit”%>
<%=submit_tag ‘SEARCH INDIVIDUAL’, :name=>“submit”%>
<%=render :partial=>‘person_fields’ , :locals=>{:p=>p}%>
<%=submit_tag ‘CREATE INDIVIDUAL’, :name=>“submit”%>
<%=submit_tag ‘SEARCH INDIVIDUAL’, :name=>“submit”%>
<%fields_for “person[organisation_attributes][]”,organisation do
|org_form|%>
Please help me
Thanks
Regards
Anks.