2

テキスト ボックスに追加された電子メール アドレスごとに invitaion_tokens を作成し、すべての電子メールを送信できるように、foreach ループを作成しようとしています。

new.html.erb

              <%= simple_form_for resource, :as => resource_name, :url => user_invitation_path(), :html => {:method => :post} do |f| %>
               <%= devise_error_messages! %>

              <div class="form-group">

              <% resource.class.invite_key_fields.each do |field| -%>
               <%= f.input :email, :class => "input-txt form-control" %><br />

              <% end -%>

               <%= f.submit t("devise.invitations.new.submit_button"), :id => "send-btn", :class => "btn btn-success" %>
              <% end %>

招待_コントローラー.rb

  def create
   self.resource = invite_resource

   if resource.errors.empty?
    yield resource if block_given?
    set_flash_message :notice, :send_instructions, :email => self.resource.email if self.resource.invitation_sent_at
    redirect_to root_path
   else
    respond_with_navigational(resource) { render :new }
   end
  end
4

0 に答える 0