在我的 'ROOT_RAILS/views/accounts/new.html.erb' 我有
<% form_for(@account, :remote => true, :url => accounts_path) do |f| %>
<div class="new_account_form">
...
</div>
<% end %>
我正在尝试在“ROOT_RAILS/views/accounts/create.js.rjs”中使用 RJS 来替换这样的 html
page.replace_html :new_account_form, :partial => "/users/accounts/new_account_partial", :locals => { :f => f }
但我收到一个错误:
undefined local variable or method `f' for <<Class:0x00000...>>
当然在 'ROOT_RAILS/views/accounts/_ew_account_partial.html.erb' 我有这样的东西:
...
<%= f.label :password %>
...
是否可以使用 RJS 传递局部变量,例如 ':locals => { :f => f }'?如果是这样,怎么做?