validating_uniqueness_of creating problem while updating

Hi!

Im validating name field in "dev" model by checking its uniqueness. but while editing that particular entry, the system again validates for uniqueness of name. so if i dnt change name while editing , it gives me error: name has already been taken.

my update code is :    1. def updateDevice    2. @device=Dev.find(params[:id])    3.
   4. @devtype=Devtype.find_by_id(params[:device][:devtype_id])    5.
   6. if request.post?    7.
   8. @device.update_attributes!(params[:device])    9. redirect_to :action=>"showDevices_admin"   10. end   11.
  12. end

what is the problem exactly?? Thanx in advance! sups

Try validates_uniqueness_of :name, :on => :create