Ruby on rails 轨道可以';我找不到我的偏爱。缺失部分错误
我生成了一个名为Comment的新模型Ruby on rails 轨道可以';我找不到我的偏爱。缺失部分错误,ruby-on-rails,view,partial,Ruby On Rails,View,Partial,我生成了一个名为Comment的新模型 rails g model Comment user_id:integer content:text rake db:migrate 然后我创建一个简单的局部视图,我打算从另一个控制器/视图调用它 产品展示视图的内部: .comments h3 | Questions and Answers: small for #{@product.name} = render 'comments/new' 缺少带有{:locale=
rails g model Comment user_id:integer content:text
rake db:migrate
然后我创建一个简单的局部视图,我打算从另一个控制器/视图调用它
产品展示视图的内部:
.comments
h3
| Questions and Answers:
small for #{@product.name}
= render 'comments/new'
缺少带有{:locale=>[:en],:formats=>[:html]的部分注释/新建,
:handlers=>[:erb,:builder,:raw,:ruby,:jbuilder,:slim,:coffee]}。
搜索:*
“/Users/sergiotapia/Documents/Work/foobar/app/views”
我停止并启动了Rails应用程序,但它仍然拒绝检测部分错误。我是不是忽略了什么
我不希望将评论表单移动到产品文件夹。文件扩展名不正确
将部分文件重命名为\u new.html.slim
。当前html
拼写错误为hmtl
请尝试以下方法:
2.2.4渲染任意文件
render方法还可以使用完全在您的视图之外的视图
应用程序(可能您正在两个Rails之间共享视图)
应用程序):
Rails确定这是一个文件渲染,因为
斜杠字符。为了明确起见,您可以使用:file选项(该选项
在Rails 2.2及更早版本中需要):
:file选项采用绝对文件系统路径。当然,你
需要对用于渲染视图的视图拥有权限
内容
摘自这里:
编辑:
哦,当然,文件名不正确,我没看到。;)参见Kirti Thorat的答案。显然,问题在于命名部分文件。看科蒂·索拉特的回答。唉,该喝杯咖啡了。我一定要喝杯咖啡。享受!!:)
render "/u/apps/warehouse_app/current/app/views/products/show"
render file:"/u/apps/warehouse_app/current/app/views/products/show"