我想material_sort_id如何獲取Ruby on Rails中的參數?
Started GET "/materials?utf8=%E2%9C%93&material%5Bmaterial_sort_id%5D=1&material%5Bbrand_id%5D=1&commit=%E6%9F%A5%E8%AF%A2" for 127.0.0.1 at 2015-05-28 16:06:34 +0800
Processing by MaterialsController#index as HTML
Parameters: {"utf8"=>"✓", "material"=>{"material_sort_id"=>"1", "brand_id"=>"1"}, "commit"=>"查詢"}
的價值,這是我的代碼:
puts params[:material_sort_id].present?
我得到了假的。我如何得到它?
好的答案提供了代碼的解釋 –