jquery - Update view not showing nested form values -


i have picture class belongs company , holds images via paperclip gem.

class picture < activerecord::base   belongs_to :company    has_attached_file :image, styles: { medium: "300x300>",                                        thumb: "100x100>" },                                        default_url: "/images/:style/missing.png"   validates_attachment :image, content_type: { content_type: ["image/jpg",                                                "image/jpeg", "image/png"] } end 

my company model looks like:

class company < activerecord::base   has_attached_file :logo_image, styles: { medium: "300x300>", thumb: "100x100>" }   has_and_belongs_to_many :primary_categories   has_and_belongs_to_many :secondary_categories   has_many :pictures, dependent: :destroy   accepts_nested_attributes_for :pictures, allow_destroy: true    validates :name, presence: true   validates_attachment :logo_image, content_type: { content_type: ["image/jpg", "image/jpeg", "image/png"] }    acts_as_taggable_on :keywords  end 

and companies_controller set pictures_attributes array:

  def company_params     params.require(:company).permit(:name, :logo_image, :address,                                     :city, :postal_code, :primary_phone,                                      :toll_free_phone, :url, :email,                                      :description, :logo, :featured,                                      :notes, keyword_list: [],                                      primary_category_ids: [],                                      secondary_category_ids: [],                                      pictures_attributes: [:id,                                                            :company_id,                                                                   :image_content_type,                                                        :image_file_size,                                                       :image_updated_at,                                                       :image_file_name,                                                        :image])   end 

i've created _picture_fields partial , included in form_for

<div class="form-inline.clearfix">   <div class= "nested-fields">     <%= f.file_field :image %>     <%= link_to_remove_association "remove", f, class: 'form-button btn btn-default'%>   </div> </div>   

my form set up:

...  <div class="form-group">   <%= f.fields_for :pictures |picture| %><br>     <%= render 'picture_fields', f: picture %>     <%= link_to_add_association 'add picture', f, :pictures, class: "btn btn-default add-button" %>   <% end %> </div>  ... 

i'm using cocoon gem add multiple fields on request create new pictures company. when save company stores pictures when go edit company, doesn't show pictures (uploaded files) in associated fields. possible values in fields?


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -