On 2/25/07, mixplate
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
>
> hi,
> i just read that you use model.build_whatever to save a child
> object...but what do you call when you have many children?
>
>
> reports has_many images....
>
> when i have 2 or more file fields in a form, what do i use to save the
> images to my report? when report has_one image, i just call
> @model.build_image(params[:something]) but how about if report has_many
> images?
>
@report.images.build(params[:first_image])
@report.images.build(params[:second_image])
If you want to find out more about this, then see:
http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html#M000642
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---