title: Ruby on Rails Form Submission Error and Success Messages
body: <p>I'm creating a landing page and I have two forms on my root page (trying to create a landing page). Very new to ruby on rails so forgive me because I'm going to explain this terribly.</p>
  
  <p>The landing page controller (landing_controller) looks like this:</p>
  
  <pre><code>class LandingController &lt; ApplicationController
    def index
      @email = Email.new
      @design = Design.new
    end
  end
  </code></pre>
  
  <p>The emails_controller (emails_controller) looks like this:</p>
  
  <pre><code>class EmailsController &lt; ApplicationController
  protect_from_forgery with: :exception
  
  def new
      @email = Email.new
  end
  
  def create
    @email = Email.new(params[email_params])
  
    respond_to do |format|
      if @email.save
        format.html  { redirect_to(root_path, :notice =&gt; 'Thank You For Subscribing!') }
        format.json  { render json: Email.create(email_params) }
      else
        format.html  { redirect_to(root_path)}
        format.json  { render :json =&gt; @email.errors, :status =&gt; :unprocessable_entity }
      end
    end
  end
  
      private
  
      def email_params
          params.require(:email).permit(:username, :email)
      end
  end
  </code></pre>
  
  <p>and the designs controller (designs_controller) looks pretty much the same as emails_controller.</p>
  
  <p>Then I have some validation in the email.rb model:</p>
  
  <pre><code>class Email &lt; ActiveRecord::Base
      validates :username, :presence =&gt; true
      validates :email, :presence =&gt; true
  end
  </code></pre>
  
  <p>And again the design.rb looks pretty much the same.</p>
  
  <p>The form I have on the landing page (root_path) index looks like this:</p>
  
  <pre><code>    &lt;%= form_for @email, url: emails_path, html: {class: "email-form"} do |f| %&gt;
      &lt;% if @email.errors.any? %&gt;
          &lt;h3&gt;Error&lt;/h3&gt;
          &lt;ul&gt;
              &lt;% @email.errors.full_messages.each do |message| %&gt;
              &lt;li&gt;&lt;%= message %&gt;&lt;/li&gt;
              &lt;% end %&gt;
          &lt;/ul&gt;
      &lt;% end %&gt;
      &lt;h2&gt;Receive Notifications&lt;/h2&gt;
      &lt;%= f.text_field :username, :class =&gt; 'email-box', :placeholder =&gt; "First Name", :autocomplete =&gt; :off %&gt;
      &lt;%= f.text_field :email , :class =&gt; 'email-box', :placeholder =&gt; "Email", :autocomplete =&gt; :off %&gt;
      &lt;%= f.submit "Subscribe", :class =&gt; 'email-submit' %&gt;
      &lt;p class="info"&gt;- We'll update ​you ​when ​we launch our new website&lt;/p&gt;
      &lt;% end %&gt;
  </code></pre>
  
  <p>When I submit the form breaking the validation I get no errors and if I submit the form following the validation rules I don't know if it creates a new entry in the database. If anyone can help I'd be very appreciative.</p>