轨道 3.1。组织部分内容
假设我有一个用 Rails 3.1 编写的小而简单的博客。所以我有 HomeController,用于显示我的博客主页,并在主块中显示导航菜单和新闻。我有 NewsController 用于管理新闻。但如果我是管理员,我希望能够从中央区块的主页管理新闻。为此,我需要一个远程表单,该表单将显示给仅具有管理员权限的用户,并编辑/删除远程链接来管理现有新闻。我应该把这个表格放在哪里?它可以是 home/_news_item_form 或 news/_form。从建筑的角度来看,您如何认为哪个地方更适合这个目的?
Assume I have a small and simple weblog written on Rails 3.1. So I have HomeController that is for displaying my blog's main page with navigation menu and news displaying in a main block. And I have NewsController that is for managing news. But I want to be able to manage news from my main page in central block if I'm an admin. For that purpose I need a remote form that will be displayed to the user with admin rights only and Edit/Delete remote links to manage existing news. Where I should place this form? It can be home/_news_item_form or news/_form. How do you think from the architectural point of view what place fits more for that purpose?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为news/_form,因为这种形式应该适用于NewsController
I think news/_form, because this form should applies in NewsController