ruby on rails - Render only One Row in link_to_add_association using cocoon gem -


i have homebannerslider model has has_many relation wih image. used cocoon gem add multiple association

to render images used following code in y form

 = f.simple_fields_for :images |image|             = render 'image_fields', f: image           .links             = link_to_add_association 'add image', f, :images 

in image field used following code

div.col-lg-12.nested-fields   div.sub_box.col-lg-12    .form-group.col-md-3      = f.input :title, input_html: {class: "form-control"}      .form-group.col-md-3      = f.input :description, input_html: {class: "form-control"}      .form-group.col-md-3       = f.input :image, as: :file, input_html: {class: "form-control"}    .form-group.col-md-3       = image_tag f.object.image.url(:thumb) if                    f.object.image.present?   = link_to_remove_association "remove image", f 

my problem whenever click on link_to_add_association build , renders three new records of images. want render 1 record on each click.


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -