Tuesday, 15 January 2013

ruby on rails - Active Admin and instantiating a new object -


I have two tables: events and images

  Events: date name of id name Images: event file captions event_id  

There are several images in an event and an image is related to an event.

My ultimate goal is to upload multiple images simultaneously in the active admin. I have read many other posts suggesting that I do the following:

  class event & Lt; ActiveRecord :: Base has_many: Accepts images: _nested_attributes_for: images mount_uploader: file, avatar tooler end class image & lt; ActiveRecord :: Base is_to: event mount_uploader: File AvatarUploader end  

Then, in my admin / event.rb, I have the following:

  Form Do | F | F.inputs "Event Details" f.input: name f.input: location f.input: date f.has_many: images do | P | P.input: file, as in: = & gt; : File, for: = & gt; [Image. Uncredited] End of End f.actions  

I am able to get visually many image upload fields, the problem is that when I save, the picture is not actually saved Are there. I believe this is because I am not creating any new image on file upload (image.) Is there any way to do this in active admin?

thanks


No comments:

Post a Comment