Formtastic 如何决定在“select”选项中使用哪个表列来表示行?
当您执行以下操作时:
form.input :users
并且属性 #users
表示 has_many 关系,然后 Formtastic 会生成一个包含用户 #id 和 #name 的 select
字段,但是...
如何Formtastic 是否决定必须使用 #name 列?
为什么不#email 或#login?是否可以指定它而无需手动创建集合?
When you do the following:
form.input :users
And the attribute #users
represents a has_many relationship, then Formtastic generates a select
field with the user #id and #name, but...
How do Formtastic decides that the #name column is what has to be used?
Why not #email, or #login? Is possible to specify it without having to create the collection manually?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我找到了答案, :select 标签的源注释如下:
https://github.com/justinfrench/formtastic/blob /master/lib/formtastic/inputs/select_input.rb
Well I found my answer, the source comments for the :select tag says the following:
https://github.com/justinfrench/formtastic/blob/master/lib/formtastic/inputs/select_input.rb