我的应用程序中有密码更新。我必须从其他控制器调用相同的表单。我添加了相同的表单,但它给了我错误未定义的局部变量或方法“资源”。如何从任何其他控制器调用更新密码?我的表格是这样的:
<%= simple_form_for(resource, as: resource_name, url: update_password_registrations_path(resource), html: { method: :put }, remote: true) do |f| %>
<div class="form-inputs">
<%= f.input :current_password, required: true, wrapper: :prepend, error: true do %>
<span class="add-on"><i class="ss-icon ss-key"></i></span>
<%= f.input_field :current_password, placeholder: "Old Password" %>
<% end %>
<%= f.input :password, required: true, wrapper: :prepend, error: true do %>
<span class="add-on"><i class="ss-icon ss-key"></i></span>
<%= f.input_field :password, placeholder: "New Password" %>
<% end %>
<%= f.input :password_confirmation, required: true, wrapper: :prepend, error: true do %>
<span class="add-on"><i class="ss-icon ss-key"></i></span>
<%= f.input_field :password_confirmation, placeholder: "New Password Confirmation" %>
<% end %>
</div>
<%= f.button :submit, "Update", class: "btn btn-primary" %>
<% end %>