Ruby on rails 是否可以传递像';这样的局部变量:本地人=>;{:f=>;f}';使用RJ?
在我的“ROOT_RAILS/views/accounts/new.html.erb”中Ruby on rails 是否可以传递像';这样的局部变量:本地人=>;{:f=>;f}';使用RJ?,ruby-on-rails,forms,ruby-on-rails-3,rjs,local-variables,Ruby On Rails,Forms,Ruby On Rails 3,Rjs,Local Variables,在我的“ROOT_RAILS/views/accounts/new.html.erb”中 <% form_for(@account, :remote => true, :url => accounts_path) do |f| %> <div class="new_account_form"> ... </div> <% end %> 但我有一个错误: undefined local va
<% form_for(@account, :remote => true, :url => accounts_path) do |f| %>
<div class="new_account_form">
...
</div>
<% end %>
但我有一个错误:
undefined local variable or method `f' for <<Class:0x00000...>>
未定义的局部变量或方法“f”
当然,在“ROOT\u RAILS/views/accounts/\u ew\u account\u partial.html.erb”中,我有如下内容:
...
<%= f.label :password %>
...
。。。
...
是否可以使用RJS传递诸如:locals=>{:f=>f}之类的局部变量?如果可以,如何传递?呃。。。您的RJ没有可用的f,因为它是从控制器调用的。如果你能管理的话,整个表单应该在部分中。嗯。。。您的RJ没有可用的f,因为它是从控制器调用的。如果您可以管理的话,整个表单应该在部分表单中。对!我没想到,对!我没有想到。
...
<%= f.label :password %>
...