Created
November 2, 2018 08:23
-
-
Save abhianair/9c0724ee9e45240f3cb108ec698adc7f to your computer and use it in GitHub Desktop.
Adding Input from Multi Select Box and converting to a string a store it in a single column in a database - Rails
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 days=(value) | |
return super value.reject!(&:blank?).join(", ") if value.is_a?(Array) | |
super | |
end |
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
<%= form.label :days %> | |
<%= form.select :days, ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'], {}, { :multiple => true, :size => 7 } %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment