Please help getting error in fields_for

I am using the fields_for and am getting a problem of

“undefined local variable or method `organisation’ for

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

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

<%=render :partial=>'organisation_with_index_nil_for_person',:collection=>@person.organisations,:locals=>{:org_form=>org_form}%>
<%=link_to_function "Add an Organisation" do |page| page.insert_html :bottom,:organisation,:partial=>'organisation/organisation_with_index_nil_for_person',:object=> end%> <%end%> <%end%>

Please help me

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs