Created
February 20, 2020 12:37
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- @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') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
= 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 | |
} | |
); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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