destroy_all function with nullify.

Hi all ,

           I am new to Ruby on Rails..            I have a requirement to handle the has_many functionality in helper itself. I have created the active_record object to the model dynamically. From the object I have tried to access the has_many functionality followed by destroy_all function.

I have posted my code and error which I received from my code . Please help me....

Thanks in advance...


I'd love to, but this code is just about beyond help. Why on EARTH are you doing this?

In any case, at least part of your problem is that the Class object created by get_active_record doesn't wind up with a *name*, which is confusing the association code (it's trying to generate the name of the foreign key for the has_many). Try assigning the class to a constant to sort that out.

As for the rest of the code, nearly *any* structure one could devise would be clearer than this. If you're using AR but not Rails, the *least* you could do would be to split out the model definitions into files and 'require' them in all at the top...

--Matt Jones

Matt Jones wrote in post #1011855: