[英]Rails Rendering Partial With a Local Variable
我正在使用的测试应用程序需要一些帮助。 我在应用程序中多次重复了此行,因此我决定将其部分渲染。 当我这样做时,我收到一条错误消息,说它没有看到局部变量。 这是正在发生的事情:
= simple_form_for ([@user, @dogs]) do |b|
= render 'dogs/dogs-cats-partials/newupload', :dog => b, :user => b
这是部分内容
.form-group.required
= b.input :title, autofocus: true, :class => "form-control", :required => false
.form-group.required
= b.input :description, autofocus: false, :class => "form-control", :required => false
这是确切的错误:
undefined local variable or method `b' for #<#<Class:0x007f2ae1d8a5a0>:0x007f2ae1b4dc60>
在此先感谢您能提供帮助的任何人。。。
“ b”从未传递给局部。 尝试这个:
render 'dogs/dogs-cats-partials/newupload', b: b, dogs: @dogs, user: @user
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.