multi select - save multiple record in single column by coma sepration, rails -


in app, use multiple countries select(check box) store multiple countries name in single column. i'm using country-select gem , in view page:

 .field     = f.label :current_country     = f.country_select :current_country, options_for_select( ["--select--"] , f.object.current_country), {}, {:multiple => true }  

by using this, i'm able select multiple counties, not save in db (eg. ---- afghanistan- aland islands- algeria). how can save multiple countries comma seprated way (like afghanistan, aland islands, algeria )

i think database relation better if want can use database serialize

take on http://apidock.com/rails/activerecord/base/serialize/class

it means can serialize example array, , when read attribute deserialize , see ruby object - array

you can take here http://weblog.bitlasoft.com/2010/05/ruby-on-rails-serializing-and-deserializing-ruby-objects/


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -