How to manage polymorphic associations with simple_form and JQuery?
This is a solution.
.
├── app
│ ├── assets
│ │ └── javascripts
│ │ └── images.js
│ ├── controllers
│ │ └── images_controller.rb
│ └── view
│ └── images
│ ├── _form.html.erb
│ ├── _imageable_select.html.erb
│ └── imageable_types.js.erb
└── config
└── routes.rb
jQuery(function() { ... });
is mandatory to make sure that the Javascript will work.
data-url
is uses as a parameter for the Javascript function.
- Scope the method
imageable_types
to render only js request.