title: Rails need to pass field to model before_create
body: <p>I have Employees, Contacts and Users.  When a new Contact or Employee is created, their respective model creates a new User.  These are the relations:</p>
  
  <pre><code>  Contact belongs_to :user
    Employee belongs_to :user  
    User has_one :contact 
    User has_one :employee 
  </code></pre>
  
  <p>Right now I've got an email field in all 3 tables.  But, I'd like to remove the email field from the Contact and Employee and only use the User.email.</p>
  
  <p>Currently the Contact Model code is this:</p>
  
  <pre><code>before_create :create_user
  
  protected
  def create_user
    self.user = User.create({ :email =&gt; self.email, :password =&gt; 'password' })
    return user.save
  end
  </code></pre>
  
  <p>The Contact form has this:</p>
  
  <pre><code>            &lt;%= f.input :email %&gt;
  </code></pre>
  
  <p>How can I get the email into the Contact form and pass it to the Contact controller to put into the new User record?</p>
  
  <p>Thanks for the help!</p>
  
  <p>UPDATE1</p>
  
  <p>I tried this, but it didn't work:</p>
  
  <p>Contact Form:</p>
  
  <pre><code>  &lt;%= text_field_tag :email %&gt;
  </code></pre>
  
  <p>Contact Controller:</p>
  
  <pre><code>  protected
    def create_user
      self.user = User.create({ :email =&gt; params[:email], :password =&gt; '123456' })
      return user.save
    end
  </code></pre>
  
  <p>UPDATE 2</p>
  
  <p>I tried this, but it doesn't work:</p>
  
  <p>Contact Form:</p>
  
  <pre><code>     &lt;%= params[:email] = email_field_tag 'email'%&gt;
  </code></pre>
  
  <p>Contact Controller:</p>
  
  <pre><code>  before_create :create_user
  
  protected
  def create_user
    self.user = User.create({ :email =&gt; params[:email], :password =&gt; '123456' })
    return user.save
  end
  </code></pre>