Hi all,
I’m trying to add photo uploads to an Advert model using Strong Params with the Paperclip gem, where Photo is a separate model which “has_attached_file” :upload, and I am calling forms_for (actually semantic_forms_for as I’m using Formtastic) in the Ads#new view to upload the image to the Photo instance. I’m calling accepts_nested_attributes for :photo in the Ad model.
From params it looks as if the upload itself is working ok. The new instance of photo is getting created in the Ads#create action, but I think I’ve missed something in the controller as it is not saving the upload attributes to the new instance. Haven’t been able to get it working despite multiple iterations of the controller code. What would I need to do differently to get it working? Have I screwed something up in the way I’m calling permit on the nested Photo model in the AdsController?
would appreciate any pointers as I haven’t found anything on StackOverflow etc that fully nails this issue of nesting with Strong Params (at least not in a way that has worked for me). I’m using Rails 3.2.13 and Ruby 1.9.3.
Would really appreciate some pointers.
Thanks