title: Rails 4 Active Model Validations
body: <p>I'm trying to create a Contact Us form on my website using Active Model.</p>
  
  <p>The problem I am having is errors messages are never returned.</p>
  
  <p>I'm using a remote form.</p>
  
  <p>routes:</p>
  
  <pre><code> resource :front_contacts, only: :create, controller: :front_contact
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code> class FrontContactController &lt; ApplicationController
     def create
       contact = FrontContact.new(params[:front_contact])
       @errors = contact.errors.size
     end
   end
  </code></pre>
  
  <p>front_contact:</p>
  
  <pre><code> class FrontContact
     include ActiveModel::Model
  
     attr_accessor :name, :email, :message
  
     validates_presence_of :name, :message
     validates_format_of :email, with: /[a-zA-Z0-9._%-]+@(?:[a-zA-Z0-9-]+\.)+(com|net|org|info|biz|me|edu|gov)/i
    end
  </code></pre>
  
  <p>js.erb:</p>
  
  <pre><code>  alert(&lt;%= @errors %&gt;);
  </code></pre>
  
  <p>The alert is always alerting zero.</p>
  
  <p>Please advise.</p>