Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 无法从收益率中放入参数_Ruby On Rails_Yield - Fatal编程技术网

Ruby on rails 无法从收益率中放入参数

Ruby on rails 无法从收益率中放入参数,ruby-on-rails,yield,Ruby On Rails,Yield,为什么我不能从收益率中提取参数 错误: undefined local variable or method `options' for #<#<Class:0x007fd1bd8735e8>:0x007fd1ba3e4fe8> /app/views/signup/new.html.erb ... <%= inline do %> <%= options %> <%= person_f.text_field(:last_na

为什么我不能从收益率中提取参数

错误:

undefined local variable or method `options' for #<#<Class:0x007fd1bd8735e8>:0x007fd1ba3e4fe8>
/app/views/signup/new.html.erb

...    
<%= inline do %>
  <%= options %>
  <%= person_f.text_field(:last_name, control_col: 7) %>
<% end %>
...
无法访问内联方法中定义的局部变量options。您必须访问内联方法传递给块的参数,为此,您需要让new.html.erb中的块接受选项参数:

  ...    
  <%= inline do |options| %>
    <%= options %>
    <%= person_f.text_field(:last_name, control_col: 7) %>
  <% end %>
  ...

你想做什么?因此,我尝试在text_字段中传递这个变量。但一开始,我不能把它放在浏览器中。
  ...    
  <%= inline do |options| %>
    <%= options %>
    <%= person_f.text_field(:last_name, control_col: 7) %>
  <% end %>
  ...
  ...    
  <%= inline do |foo| %>
    <%= foo %>
    <%= person_f.text_field(:last_name, control_col: 7) %>
  <% end %>
  ...