EamonnMcElroy
EamonnMcElroy

Reputation: 607

Link two attributes to one form element

I want to be able to have one select which specifies the value of two model attributes. Therefore if you were to select "yes" on a drop-down it would set the value of attribute a and attribute b to "yes" when the form is submitted. Although the below doesnt work it might help explain what I mean:

= f.select :trial, :free , [['Yes', 'true'], ['No', 'false']], {}, class: 'selectpicker mandatory'

Upvotes: 0

Views: 44

Answers (1)

Andrey Deineko
Andrey Deineko

Reputation: 52347

You can not do that.

What you can do instead, is upon validating the object set the free attribute equal to trial (that was set by selecting from a dropdown).

Upvotes: 1

Related Questions