rails multi select dropdown is not working

rails multi select dropdown is not working

When i select few options from this multi select dropdown and save, I am seeing none of the options selected in the view(after reloading the page, i am seeing a dropdown in which nothing is selected). i am unable to understand what is the issue.

When i select few options from this multi select dropdown and save, I am seeing none of the options selected in the view(after reloading the page, i am seeing a dropdown in which nothing is selected). i am unable to understand what is the issue.

I am using the following rails multi select dropdown.

<%= f.select(:funds_held_on__c, [['Type A', 'Type A'],
                              ['Type B', 'Type B'],
                              ['Type C', 'Type C'],
                              ['Type D', 'Type D'],
                              ['Type E', 'Type E']
                             ],{ :prompt => "Please select"},
                               { :multiple => true, :size => 5 }
                             ) %>

i am having the following code in the controller,in params whitelisting.

     :funds_held_on__c => []

the datatype of the field is string.

    funds_held_on__c: string,

in rails console, i am seeing the data saved like below.

      mm.funds_held_on__c
      => "[\"\", \"Type B\", \"Type C\", \"Type D\"]" 


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Ruby on Rails vs PHP

Understanding the pros and cons of Ruby on Rails versus PHP is important when deciding how to create your business-critical applications.