read params

If what you want is to verify that the email is unique/valid, put
these two lines in your model.

  validates_format_of :email, :with =>
/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i, :message => "Invalid
  validates_presence_of :email

If you really want to modify whatever the user passed in, you can do
something like this:
  params[:user][:email] = ""

-javier godinez

What does your controller look like?


def new
# ...

Goes in your controller!

Michael M. wrote:

this is my controller.

class UserController < ApplicationController

  def index

  def new
    @user =[:user])
    return unless
      redirect_to(:action => 'index')

  def edit

  def list


it works, but when I add the line = params[:user][:email] I receive the error message.

puts params[:user].inspect
{"name"=>"abc", "email"=>""}

I thing the problem is I, cannt read "email"=>"" with params[:user][:email]

You've got to make sure you only access params[:user][:email]
on a post, because params[:user] will be nil on a get, and
you'll get an error.

I think you are trying to access both the user and the email and store
in the user table right? if that is the case you can do something like
this"user" => params[:user], email => params[:email]).