```ruby
class ContactMessagesController < ApplicationController

  respond_to :html

  def create
    if params.has_key? :contact_form
      create_contact_message(params[:contact_form])
    else
      redirect_to root_path, notice: t(".controllers.messages.errors.missing_form_data")
    end
  end


  private

  def create_contact_message(form_data)
    message = ContactMessage.new(form_data)
    if message.deliver
      flash[:notice] = t(".controllers.messages.success.email_sent")
      render :index
    else
      flash[:notice] = t(".controllers.messages.errors.email_not_sent")
      render :index
    end
  end

end
```

Use inherited resources to handle validation and send the email message.
user
```ruby
class ContactMessagesController < InheritedResources::Base
  actions :new, :create

  respond_to :html

  def create
    create!(notice: t(".controllers.messages.success.email_sent"))
  end
end
```
assistant