I am implementing a multi-model form and it is carried across multiple pages. I have a method to try and ensure that the nested model only gets generated once:
def initialize(*params)
super(*params)
if (@new_record)
@main_generated = false
end
end
def generate_main
if !@main_generated
members.build(:main => true, :firstname => "Hello World")
@main_generated = true
end
end
The problem is that it appears that my main_generated variable is not accessible. How come? Is there a way to check if, for example, @account.members contained a member that was built but not saved?