uninitialized constant ApplicationMailer
<p>I'm trying to make a contact form work by following <a href="http://www.murdo.ch/posts/build-a-contact-form-with-rails-4-2" rel="nofollow">this tutorial</a>, but I keep having the error : <code>uninitialized constant ApplicationMailer</code> after i submit the form.</p>

<p>the traces give the following informations:</p>

<pre><code>app/mailers/message_mailer.rb:1:in &lt;top (required)&gt;'
app/controllers/messages_controller.rb:9:in create'
actionpack (4.2.5) lib/action_controller/metal/implicit_render.rb:4:in send_action'
actionpack (4.2.5) lib/abstract_controller/base.rb:198:in process_action'
actionpack (4.2.5) lib/action_controller/metal/rendering.rb:10:in process_action'
actionpack (4.2.5) lib/abstract_controller/callbacks.rb:20:in block in process_action'
activesupport (4.2.5) lib/active_support/callbacks.rb:117:in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:117:in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:555:in block (2 levels) in compile'
activesupport (4.2.5) lib/active_support/callbacks.rb:505:in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:505:in call'
activesupport (4.2.5) lib/active_support/callbacks.rb:92:in __run_callbacks__'
activesupport (4.2.5) lib/active_support/callbacks.rb:778:in _run_process_action_callbacks'`
</code></pre>

<p>Here are the file i have :
<strong>controllers/messages_controller.rb</strong></p>

<pre><code>class MessagesController &lt; ApplicationController
def new
    @message = Message.new
end
def create
@message = Message.new(message_params)

if @message.valid?
  MessageMailer.message_me(@message).deliver_now
  redirect_to new_message_path, notice: "Thankyou for your message."
else
  render :new
end
end

private

def message_params
  params.require(:message).permit(:name, :email, :subject, :content)
end
end
</code></pre>

<p><strong>models/message.rb</strong></p>

<pre><code>class Message
 include ActiveModel::Model
 attr_accessor :name, :email, :subject, :content
 validates :name, :email, :subject, :content, presence: true
end
</code></pre>

<p><strong>mailers/message_mailer.rb</strong></p>

<pre><code>class MessageMailer &lt; ApplicationMailer

default :to =&gt; "jd.levarato@gmail.com"
def message_me(msg)
  @msg = msg

  mail from: @msg.email, subject: @msg.subject, body: @msg.content
end
end
</code></pre>