如何根据下拉菜单选择查询我的数据库?
看法:
<div class="field">
<label>Category</label><br />
<select name="category[id]" id="category_id">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</div>
控制器:
s = params[category_id]
@users = User.where("status = ?", s)