title: Validation failed: Email can't be blank, Password can't be blank
body: <p>I am getting this error <strong>Validation failed: Email can't be blank, Password can't be blank</strong> when i try to do signup. i am using devise's custom registration controller for sign up. i am using the model employee in place of user.</p>
  
  <p>The custom <strong>registration_controller.rb</strong> </p>
  
  <pre><code>class RegistrationsController &lt; Devise::RegistrationsController
  
    def new
      @employee = Employee.new
      @organisation = Organisation.new
      getLocation
    end
  
    def create
      @organisation = Organisation.new
      setOrganizationValues
      @employee = Employee.new
      setEmployeeValues
  
      Employee.transaction do
          @organisation.save!
  
          @employee.org_id = @organisation.org_id
          @employee.save!
      end
  
      respond_to do |f|
        f.html {redirect_to employees_path}
      end
          # if @employee.save
          #   flash[:notice] = "Employee was successfully created"
          #   redirect_to employees_path
          # else
          #   flash[:notice] = "Employee was not created"
          # end
    end
  
    def getLocation
      @locations = Location.select("location_id, location_name")
                                  .where("status = 1")
                                  .order("location_name")
    end
  
    def setCountryName
      loc = Location.select("location_name")
                                  .where("location_id = ?",params[:country])
      @organisation.country = loc.first.location_name
    end
  
    def setOrganizationValues
      p "***********setOrganizationValues****************"
      @organisation.org_name = params["org_name"]
      @organisation.location_id = params["country"]
      @organisation.city = params["city"]
      @organisation.state = params["state"]
      @organisation.email_id = params["email_id"]
      @organisation.address = params["address"]
      setCountryName
    end
  
    def setEmployeeValues
      p "***********setEmployeeValues****************"
      @employee.email = params["email"]
      @employee.password = params["password"]
      @employee.first_name = params["first_name"]
      @employee.middle_name = params["middle_name"]
      @employee.last_name = params["last_name"]
      # @employee.state = params["state"]
      # @employee.email_id = params["email_id"]
      # @employee.address = params["address"]
    end
  
  end
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>Rails.application.routes.draw do
    # devise_for :employees, :controllers =&gt; { :registrations =&gt; "registrations" }, :path =&gt; "", :path_names =&gt; {:sign_out =&gt; "signout", :sign_up =&gt; "signup"}
  
    devise_for :employees, :controllers =&gt; {:registrations =&gt; "registrations"}
  
    # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
    root 'organisations#index'
    resources :organisations
    resources :roles
    resources :clients
    resources :project_tasks
    resources :projects
    resources :employees
    get '/projects', to: 'projects#index'
    get '/employees', to: 'employees#index'
  end
  </code></pre>
  
  <p>The View <strong>new.html.erb</strong> </p>
  
  <pre><code>&lt;%= form_for(resource, as: resource_name, url: registration_path(resource_name), :html =&gt; {:id =&gt; "example-advanced-form"}) do |f| %&gt;
  &lt;br&gt;&lt;br&gt;
      &lt;h3&gt;Account&lt;/h3&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Account Information&lt;/legend&gt;
  
          &lt;%= f.label :email %&gt;&lt;br&gt;
          &lt;%= f.text_field :email, :id =&gt; "email-2", :class =&gt; "required email" %&gt;
          &lt;%= f.label :password %&gt;&lt;br&gt;
          &lt;%= f.password_field :password, :id =&gt; "password-2", :class =&gt; "required" %&gt;
          &lt;%= f.label :password_confirmation %&gt;&lt;br&gt;
          &lt;%= f.password_field :password_confirmation, :name =&gt; "confirm", :id =&gt; "confirm-2", :class =&gt; "required" %&gt;
          &lt;p&gt;(*) Mandatory&lt;/p&gt;
      &lt;/fieldset&gt;
  
      &lt;h3&gt;Profile&lt;/h3&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Profile Information&lt;/legend&gt;
  
          &lt;div class="container-fluid"&gt;
            &lt;div class="row"&gt;
              &lt;div class="col-lg-6"&gt;
  
          &lt;label&gt;First Name&lt;/label&gt;&lt;br&gt;
          &lt;%= text_field_tag "first_name",@employee.first_name,
                    :autocomplete =&gt; :off,:id =&gt; "name-2",:maxlength =&gt; 13,:required =&gt; true%&gt;
          &lt;label&gt;Middle Name&lt;/label&gt;&lt;br&gt;
          &lt;%= text_field_tag "middle_name",@employee.middle_name,
                    :autocomplete =&gt; :off,:id =&gt; "surname-2",:maxlength =&gt; 13,:required =&gt; true%&gt;
          &lt;label&gt;Last Name&lt;/label&gt;&lt;br&gt;
          &lt;%= text_field_tag "last_name",@employee.last_name,
                    :autocomplete =&gt; :off,:id =&gt; "surname-2",:maxlength =&gt; 13,:required =&gt; true%&gt;
  
          &lt;label&gt;Designation&lt;/label&gt;&lt;br&gt;
          &lt;select class="required"&gt;
            &lt;option value="Developer"&gt;Developer&lt;/option&gt;
            &lt;option value="Tester"&gt;Tester&lt;/option&gt;
            &lt;option value="Manager"&gt;Manager&lt;/option&gt;
            &lt;option value="Other"&gt;Other&lt;/option&gt;
          &lt;/select&gt;
          &lt;br&gt;
            &lt;label&gt;Organisation Name&lt;/label&gt;&lt;br&gt;
            &lt;%= text_field_tag "org_name",@organisation.org_name,
                                          :autocomplete =&gt; :off,:id =&gt; "phone",:maxlength =&gt; 13,:required =&gt; true%&gt;
            &lt;label&gt;organisation Business Type&lt;/label&gt;&lt;br&gt;
            &lt;select class="required"&gt;
              &lt;option value="Business"&gt;Business&lt;/option&gt;
              &lt;option value="Finance"&gt;Finance&lt;/option&gt;
              &lt;option value="IT"&gt;IT&lt;/option&gt;
              &lt;option value="Other"&gt;Other&lt;/option&gt;
            &lt;/select&gt;&lt;br&gt;
            &lt;/div&gt;
            &lt;div class="col-lg-6"&gt;
            &lt;label&gt;Number Of Employees&lt;/label&gt;&lt;br&gt;
            &lt;select class="required"&gt;
              &lt;option value="0-10"&gt;0-10&lt;/option&gt;
              &lt;option value="10-50"&gt;10-50&lt;/option&gt;
              &lt;option value="50-100"&gt;50-100&lt;/option&gt;
              &lt;option value="100-500"&gt;100-500&lt;/option&gt;
              &lt;option value="500-1000"&gt;500-1000&lt;/option&gt;
              &lt;option value="1000 above"&gt;1000 above&lt;/option&gt;
            &lt;/select&gt;&lt;br&gt;
  
            &lt;label&gt;Address&lt;/label&gt;&lt;br&gt;
            &lt;%= text_field_tag "address",@organisation.address,
                                          :autocomplete =&gt; :off,:id =&gt; "address",:required =&gt; true%&gt;
            &lt;label&gt;City&lt;/label&gt;&lt;br&gt;
            &lt;%= text_field_tag "city",@organisation.city,
                                          :autocomplete =&gt; :off,:id =&gt; "city",:required =&gt; true%&gt;
            &lt;label&gt;State&lt;/label&gt;&lt;br&gt;
            &lt;%= text_field_tag "state",@organisation.state,
                                          :autocomplete =&gt; :off,:id =&gt; "state",:required =&gt; true%&gt;
            &lt;label&gt;Country&lt;/label&gt;&lt;br&gt;
            &lt;!-- &lt;%= text_field_tag "country",@organisation.country,
                                          :autocomplete =&gt; :off,:id =&gt; "country",:required =&gt; true%&gt; --&gt;
            &lt;%= select_tag :country, options_for_select(@locations.collect{ |l| [l.location_name, l.location_id]})%&gt;
            &lt;label&gt;Organisation Email&lt;/label&gt;&lt;br&gt;
            &lt;%= text_field_tag "email_id",@organisation.email_id,
                                          :autocomplete =&gt; :off,:id =&gt; "email_id",:required =&gt; true%&gt;
  
  
        &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;/fieldset&gt;
  
      &lt;h3&gt;Finish&lt;/h3&gt;
      &lt;fieldset&gt;
          &lt;legend&gt;Confirmatio&lt;/legend&gt;
  
          &lt;p&gt;We have sent you a mail for Activation of your Account. Kindly Activate your through the mail. If you haven't received any mail, please click &lt;/p&gt;
          &lt;%= link_to "here" %&gt;
      &lt;/fieldset&gt;
  
  &lt;% end %&gt;
  
  &lt;script&gt;
  var form = $("#example-advanced-form").show();
  
  form.steps({
      headerTag: "h3",
      bodyTag: "fieldset",
      transitionEffect: "slideLeft",
      onStepChanging: function (event, currentIndex, newIndex)
      {
          // Allways allow previous action even if the current form is not valid!
          if (currentIndex &gt; newIndex)
          {
              return true;
          }
          // Forbid next action on "Warning" step if the user is to young
          if (newIndex === 3 &amp;&amp; Number($("#age-2").val()) &lt; 18)
          {
              return false;
          }
          // Needed in some cases if the user went back (clean up)
          if (currentIndex &lt; newIndex)
          {
              // To remove error styles
              form.find(".body:eq(" + newIndex + ") label.error").remove();
              form.find(".body:eq(" + newIndex + ") .error").removeClass("error");
          }
          form.validate().settings.ignore = ":disabled,:hidden";
          return form.valid();
      },
      onStepChanged: function (event, currentIndex, priorIndex)
      {
          // Used to skip the "Warning" step if the user is old enough.
          if (currentIndex === 2 &amp;&amp; Number($("#age-2").val()) &gt;= 18)
          {
              form.steps("next");
          }
          // Used to skip the "Warning" step if the user is old enough and wants to the previous step.
          if (currentIndex === 2 &amp;&amp; priorIndex === 3)
          {
              form.steps("previous");
          }
      },
      onFinishing: function (event, currentIndex)
      {
          form.validate().settings.ignore = ":disabled";
          return form.valid();
      },
      onFinished: function (event, currentIndex)
      {
          form.submit();
          alert("Submitted!");
      }
  }).validate({
      errorPlacement: function errorPlacement(error, element) { element.before(error); },
      rules: {
          confirm: {
              equalTo: "#password-2"
          }
      }
  });
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>employee.rb</strong></p>
  
  <pre><code>class Employee &lt; ApplicationRecord
  
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable
    has_many :tasks
    belongs_to :organisation
    belongs_to :role
    accepts_nested_attributes_for :organisation
    validates :first_name, presence: true, length: { minimum: 5 }
    validates :last_name, presence: true, length: { minimum: 5 }
  end
  </code></pre>
  
  <p>I am a newbie to rails. can anybody help me to solve this issue?</p>