選択したform_tagパラメータですべての重複文字列を削除する最も良い方法を知っています。選択したパラメータ配列の重複文字列を削除します
私は.uniq
と.distinct
を試しましたが、動作しません。
<%= select_tag(:city, options_for_select(@customers.where(user: current_user).collect{ |b| [b.city, b.city]}), {:prompt => "City", :class => "form-control select-search"}) %>
マイselect_tag
彼らは同じであっても、各顧客の都市を与えます。
この '@のcustomers.where試してみてください(ユーザー:CURRENT_USER).distinct.collectを{| B | [b.city、b.city]} ' – Vishal
助けてくれてありがとうございます。@Vishal –
あなたは直面している問題を共有できますか? – Vishal