Access form submitted values inside model class

Hi All,

I am sure some one of you might have faced this. I am trying to
validate the user submitted values inside a model class. I use the
validates_presence_of and validates_uniqueness_of methods inside the
model class.

All this works well. I now want show a error message which contains
the user submitted value.

For eg.

Username “penuel” is already in use.

Here “penuel” is the value entered by user in the form username text
box, which is already used by some user.

currently I use the following method inside the model class

validates_uniqueness_of(:username, :message=>“Username is already in

How can embed the actual username submitted by user in the above error

Any pointers to this?

Thanks in advance.