我正在爲我的Rails(2.3.9,但我已檢查到此問題也存在於3.0.3)應用程序中寫入搜索表單。 問題是Rails正在從用戶輸入中剝去引號。 我想給用戶的可能性寫:Rails從輸入表格中刪除引號的問題
- 「Ruby on Rails的」:這會搜索全文整個字符串在軌道上
- 紅寶石:這將搜索與所有的三篇文章也就是說
但在我的控制器,這兩種情況下我得到只有一個字符串:
Processing NewsController#index (for 127.0.0.1 at 2010-11-23 10:23:15) [GET]
Parameters: {"action"=>"index", "controller"=>"news", "search"=>{"category"=>"", "news_agency"=>"", "fullsearch"=>"ruby on rails", "order"=>""}}
是否有任何選項來跳過此剝離QUOT標誌?
備註: 當用戶添加空格兩側例如用於搜索字符串: 「‘Ruby on Rails的’」字符串將被正確傳送:
Processing NewsController#index (for 127.0.0.1 at 2010-11-23 10:23:15) [GET]
Parameters: {"action"=>"index", "controller"=>"news", "search"=>{"category"=>"", "news_agency"=>"", "fullsearch"=>" \"ruby on rails\" ", "order"=>""}}
是啊,這是我後來發現,但忘了回答我自己的問題......謝謝:) – 2010-12-17 19:30:48