خرید بک لینک

Vote count: 0

i have this form for creating a new dance. I have 2 different models Country and Region that both have many dances. and Dance belongs to both Country and Region. when i create the dance with dance_params which permit country_id and region_id, the dance attributes do not update with region_id and country_id. im sure something in this fields for lines, but no idea how to solve it. i need the relationship between countries and regions bc i want to be able to group regions based on countries when i select country. please help!

= simple_form_for @dance do |f|
= f.fields_for :countries do |country| = country.collection_select :id, Country.order(:name),:id,:name, {prompt: "Please Select Country"}, {:class => "form-control"}

      = f.fields_for :regions do |region|
        = region.grouped_collection_select :id, Country.order(:name),:regions, :name, :id, :name, {prompt: "Please Select Region" }, {:class => "form-control"}

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 13 فروردين 1395 ساعت: 20:18

صفحه بندی