我正在处理视图并尝试创建一个表单,其中只能选择多个单选按钮中的一个作为true。单选按钮分别与各个布尔值相连。
相关型号代码
class ModelNameReason < ActiveRecord::Base
MODEL_NAME_REASON_OPTIONS = {bool_one: 'Reason 1',
bool_two: 'Test Reason',
bool_three: 'Consumer Reason',
bool_for: 'Time Contraint Reason',
bool_five: 'Problem with Requirements',
}
相关观看代码
= f.fields_for :model_name_reason do |builder|
= render 'model_name_reason_fields', f: builder
答案 0 :(得分:0)
简单的HTML:
;WITH CTE AS(
SELECT
Player1 AS LoggedInPlayer,
ROW_NUMBER() OVER (PARTITION BY Player1 ORDER BY datecolumn Asc) As LoggedValue
FROM
yourtable
)
SELECT
*
FROM
CTE
WHERE
LoggedValue = 1
对要“链接”到同一变量的所有单选按钮使用相同的<form method="post">
<fieldset>
<legend>What is Your Favorite Pet?</legend>
<input type="radio" name="animal" value="Cat" />Cats<br />
<input type="radio" name="animal" value="Dog" />Dogs<br />
<input type="radio" name="animal" value="Bird" />Birds<br />
<input type="submit" value="Submit now" />
</fieldset>
</form>
属性。