如何在一个视图中显示 2 个模型
为了学习 Rails,我编写了一个小 Web 应用程序,用于跟踪哪个员工正在使用哪台计算机以及计算机上安装了哪些软件。我开始于 rails 生成脚手架客户端 deviceName:string deviceComment:text
一切工作正常,我可以添加、编辑或销毁客户端。现在我想跟踪每台机器上安装的软件。这次我只创建了一个模型 rails生成模型软件标题:字符串许可证:字符串
我现在的问题是,如何“添加”软件标题和许可证号?
我想在可以添加新客户端的同一站点上显示软件标题的标签和许可证号。精确于客户/新站点。
这可能吗?
预先感谢您的回答!
问候, 布克
to learn rails i have written a little webapp, to track which employee is using which computer and what software is installed on it. I started withrails generate scaffold Client deviceName:string deviceComment:text
Everything works fine and i can add, edit or destroy Cients. Now i want to track the software which is installed on every machine. This time i only created a model withrails generate model Software title:string licence:string
My question is now, how can i "add" Softwaretitle and the licencenumber?
i want to show the Label for the softwaretitle and the licencenumber on the same site where i can add new clients. Precise on the clients/new site.
Is this possible?
Thanks in advance for your answers!
Regards,
Buk
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要设置模型之间的关系,您可以在那里阅读 http://edgeguides.rubyonrails.org/association_basics.html 之后就可以调用客户端相关的软件了
You need setup relationship between models, you can read it there http://edgeguides.rubyonrails.org/association_basics.html After that you can call software that related to the client