Rails 3 Data Modeling Help - Has Many, Belongs to, Nested Atrributes?

"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!

You're just about there. The main issue is that you're trying to create recipient objects in the form rather than just creating a relationship between the award and another object (user). You could do something like this.

You're just about there. The main issue is that you're trying to create recipient objects in the form rather than just creating a relationship between the award and another object (user). You could do something like this: class User :recipients end # this is your relationship between an award and a user class Recipient :recipients belongs_to :announcer accepts_nested_attributes_for :recipients, :allow_destroy => true end class Announcer :awards end Then you would just do a nested form that would build the recipients_attributes array: '/recipients/new', :locals => {:recipient => recipient, :f => f} %> '/recipients/new').

To_json})" %> And, to keep it DRY just push the nested part into a partial: # app/views/recipients/_new.html. Erb Obviously the User. All call isn't ideal so maybe make that an autocomplete.

Mike, many thanks for your help. Being a nuby, I am still trying to wrap this around my head. Will try out your solution tonight.Thanks.

Have a great weekend – coder Mar 19 at 0:48 Here's a snippet from a current project for the sake of having another example: has_many nested form example – mikeonrails Mar 19 at 1:39 I have been trying to modify my code based on your suggestions. My recipient and announcer models are tied w/devise, after playing around so such... I justed added your code to make a new one to see how it works, however got this error message undefined local variable or method `f' for #2 line in the partial file. Do not have a clue how to proceed now, pls help.

Thanks – coder Mar 22 at 17:06 Pass the containing form to the partial: '/recipients/new', :locals => {:recipient => recipient, :f => form} %> - updating answer – mikeonrails Mar 22 at 18:04.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions