{"action":"created","issue":{"url":"https://api.github.com/repos/rubytaiwan/AMA/issues/70","labels_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/70/labels{/name}","comments_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/70/comments","events_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/70/events","html_url":"https://github.com/rubytaiwan/AMA/issues/70","id":113964513,"number":70,"title":"想請教一下，如何讓表單的某個欄位又能下拉選擇又能輸入新的值？","user":{"login":"afgnsu","id":7204469,"avatar_url":"https://avatars.githubusercontent.com/u/7204469?v=3","gravatar_id":"","url":"https://api.github.com/users/afgnsu","html_url":"https://github.com/afgnsu","followers_url":"https://api.github.com/users/afgnsu/followers","following_url":"https://api.github.com/users/afgnsu/following{/other_user}","gists_url":"https://api.github.com/users/afgnsu/gists{/gist_id}","starred_url":"https://api.github.com/users/afgnsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afgnsu/subscriptions","organizations_url":"https://api.github.com/users/afgnsu/orgs","repos_url":"https://api.github.com/users/afgnsu/repos","events_url":"https://api.github.com/users/afgnsu/events{/privacy}","received_events_url":"https://api.github.com/users/afgnsu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rubytaiwan/AMA/labels/Rails","name":"Rails","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-29T02:17:42Z","updated_at":"2015-11-04T02:55:22Z","closed_at":null,"body":"如題。假設一個客戶資料表(customers)好了，公司名稱(company)欄位裡面可能已經有『HTC、ASUS、Apple、Samsung』可以供下拉選擇，也可以輸入新的（例如：小米、華為），那 simple_form 表單應該如何設計？"},"comment":{"url":"https://api.github.com/repos/rubytaiwan/AMA/issues/comments/153555813","html_url":"https://github.com/rubytaiwan/AMA/issues/70#issuecomment-153555813","issue_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/70","id":153555813,"user":{"login":"afgnsu","id":7204469,"avatar_url":"https://avatars.githubusercontent.com/u/7204469?v=3","gravatar_id":"","url":"https://api.github.com/users/afgnsu","html_url":"https://github.com/afgnsu","followers_url":"https://api.github.com/users/afgnsu/followers","following_url":"https://api.github.com/users/afgnsu/following{/other_user}","gists_url":"https://api.github.com/users/afgnsu/gists{/gist_id}","starred_url":"https://api.github.com/users/afgnsu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/afgnsu/subscriptions","organizations_url":"https://api.github.com/users/afgnsu/orgs","repos_url":"https://api.github.com/users/afgnsu/repos","events_url":"https://api.github.com/users/afgnsu/events{/privacy}","received_events_url":"https://api.github.com/users/afgnsu/received_events","type":"User","site_admin":false},"created_at":"2015-11-04T02:55:22Z","updated_at":"2015-11-04T02:55:22Z","body":"To ilake：\r\n\r\n(1). 該欄位不能為空白，也不能重複。validates :company, presence: true,  uniqueness: true\r\n(2). 該欄位預設為下拉選單（例：HTC、ASUS、Apple），但也可以輸入文字（可以另外一個文字對話框），如果輸入文字時，會自動比對資料庫是否重複 (看來要用Ajax去做比對檢查)。\r\n\r\n我目前遇到的問題是，(1) 都OK，但 (2) 輸入文字時，重複會自動儲存空白 :p"}}