Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Created February 20, 2020 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save staycreativedesign/8a2219ccd63d241d2cbf7737c2578303 to your computer and use it in GitHub Desktop.
Save staycreativedesign/8a2219ccd63d241d2cbf7737c2578303 to your computer and use it in GitHub Desktop.
This is what Im trying to do whenever a DetailCategory is selected it updates the _details_subs partial
- @detail_subs.each do |sub|
.form-group
= sub.title
= f.select(:detail_category_ids, options_from_collection_for_select(sub.details, 'id', 'title'), {}, class: 'chosen-select-detail form-control')
= f.select(:detail_category_ids, options_from_collection_for_select(@detail_category, 'id', 'title'), {}, class: 'chosen-select-detail form-control')
.form-grup
#detail_subs
:javascript
$(".chosen-select-detail").chosen().change(
function() {
#when detail_category is changed i want it to load the detail_subs for the detail_category
}
);
def new
@entry = Entry.new
@detail_category = DetailCategory.all
@detail_subs = @detail_category.first.detail_subs
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment