3

フォーム パスはuser/invitations/invitations/edit.html.erbnew.html.erb

Edit.html.erb

    <h2><%= t 'devise.invitations.edit.header' %></h2>
    <%= form_for resource, :as => resource_name, :url => invitation_path(resource_name),  :html => { :method => :put } do |f| %>
    <%= devise_error_messages! %>
    <%= f.hidden_field :invitation_token %>

    <p><%= f.label :username %><br />
    <%= f.text_field :username %></p>

    <p><%= f.label :password %><br />
    <%= f.password_field :password %></p>

    <p><%= f.label :password_confirmation %><br />
    <%= f.password_field :password_confirmation %></p>

    <p><%= f.submit t("devise.invitations.edit.submit_button") %></p>
    <% end %>

自分で次を追加しましたedit.html.erbが、フォームにフィールドが表示されません

    <p><%= f.label :username %><br />
    <%= f.text_field :username %></p>

これに対処する方法を教えてください。そして、devise_invitable のフォームをカスタマイズします

4

2 に答える 2

3

次のコマンドでビューを再度生成しました。

    rails generate devise_invitable:views users

そして、ネストされた users/invitations/invitations/edit.html.erb が間違っていることがわかりました。

views/users/invitations/edit.html.erb のようにする必要があります

これで問題が解決し、devise_invitable フォームをカスタマイズできるようになりました。

于 2013-02-27T08:47:58.740 に答える
1

交換フォームはこちら

app/views/devise/invitations/edit.html.erb
于 2013-02-27T07:53:10.423 に答える