title: Ruby on rails - No template found for InvitesController#create
body: <p>I want to create an invitation system with rails 5 and mongoid. But when I want to sent an email i have this error : </p>
  
  <pre><code>Recipient can't be blank
  something goes wrong
  Recipient can't be blank
  No template found for InvitesController#create, rendering head :no_content
  Completed 204 No Content in 137ms
  </code></pre>
  
  <p>Here is the code : </p>
  
  <p><strong>invite.rb</strong></p>
  
  <pre><code>class Invite
    include Mongoid::Document
    include Mongoid::Timestamps
  
    field :email, type: String
    field :token, type: String
  
    belongs_to :project
    belongs_to :sender_id, :class_name =&gt; 'User', inverse_of: :recipient_id
    belongs_to :recipient_id, :class_name =&gt; 'User', inverse_of: :sender_id
  
    before_create :generate_token
  
    def generate_token
      self.token = Digest::SHA1.hexdigest([self.project_id, Time.now, rand].join)
    end
  end
  </code></pre>
  
  <p><strong>project.rb</strong></p>
  
  <pre><code>class Project
    include Mongoid::Document
    include Mongoid::Timestamps
  
    # Principle informations concerning project
    field :title, type: String
    field :description, type: String
    field :client, type: String
    field :deadline, type: String
    field :creator_id, type: String
  
    belongs_to :owner, :class_name =&gt; 'User', inverse_of: :members
    has_many :members, :class_name =&gt; 'User', inverse_of: :owner
    has_many :invites
  end
  </code></pre>
  
  <p><strong>user.rb</strong></p>
  
  <pre><code>class User
    include Mongoid::Document
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise  :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable
  
    ## Database authenticatable
    field :email,              type: String, default: ""
    field :encrypted_password, type: String, default: ""
  
    ## Recoverable
    field :reset_password_token,   type: String
    field :reset_password_sent_at, type: Time
  
    ## Rememberable
    field :remember_created_at, type: Time
  
    ## Trackable
    field :sign_in_count,      type: Integer, default: 0
    field :current_sign_in_at, type: Time
    field :last_sign_in_at,    type: Time
    field :current_sign_in_ip, type: String
    field :last_sign_in_ip,    type: String
  
    has_many :projects, inverse_of: :projects
    has_many :invitations, :class_name =&gt; 'Invite', :foreign_key =&gt; 'recipient_id'
    has_many :sent_invites, :class_name =&gt; 'Invite', :foreign_key =&gt; 'sender_id'
  end
  </code></pre>
  
  <p>the form for sending an invitation on the user page : </p>
  
  <pre><code>&lt;%= form_for @invite do |f| %&gt;
              &lt;%= f.text_field :project_id, :value =&gt; @project.id %&gt;
              &lt;%= f.label :email %&gt;
              &lt;%= f.email_field :email %&gt;
              &lt;%= f.submit 'Send' %&gt;
          &lt;% end %&gt;
  </code></pre>
  
  <p><strong>invites_controller.rb</strong></p>
  
  <pre><code>class InvitesController &lt; ApplicationController
      def new 
          @invite = Invite.new
      end
  
      def create 
          @invite = Invite.new(invite_params)
          @invite.sender_id = current_user.id
          if @invite.save
              InviteMailer.new_user_invite(@invite, new_user_registration_path(:invite_token =&gt; @invite.token)).deliver
              redirect_to user_path(current_user.id)
          else
              puts @invite.errors.full_messages
              puts "something goes wrong"
          end
          puts @invite.errors.full_messages
      end
  
      private
      def invite_params
          params.require(:invite).permit(:email, :token, :sender_id, :recipient_id, [:project_id])
      end 
  end
  </code></pre>
  
  <p>I want that the owner be able to invite other people, if the user exist it send the mail to the existing user, but if not, it send a link to create an account and register in the project,</p>
  
  <p>what I have forget ? And Why i have this error ?</p>
  
  <p>Thank ! </p>