您可以使用选择助手更改多个属性吗?
我正在使用以下选择助手:
f.select(:page_color, Orders::PAYMENT_TYPES ,:prompt => "Select a Box")
是否可以通过一项选择更改多列?假设我想通过选择“检查”来更改 :page_color 和 :pay_method 。这可能吗?
PAYMENT_TYPES = [
# Displayed stored in db
[ "Check", "check" ],
[ "Credit card", "cc" ],
[ "Purchase order", "po" ]
]
I'm using the following select helper:
f.select(:page_color, Orders::PAYMENT_TYPES ,:prompt => "Select a Box")
is it possible to change multiple columns with one selection? Say I want to change :page_color and :pay_method with the selection of "Check". Is this possible?
PAYMENT_TYPES = [
# Displayed stored in db
[ "Check", "check" ],
[ "Credit card", "cc" ],
[ "Purchase order", "po" ]
]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为最干净的事情是编写一个虚拟属性:
I think the cleanest thing would be to write a virtual attribute: