@errors issue

hey all, I use validates_uniqueness_of :name. In script/console when i do find_or_create_by_name('bob') and that bob already exists I get @errors=> name has already been taken taken. But in my createname.rhtml it doesn't display anything though I did put <%= error_messages_for :user %>.

this is my controller:

@user = find_or_create_by_name('bob')

if @user.save redirect_to :list else render :action=>'createname' end

thanx in advance

Pat

Why would you get an error if you’re asking to find, and if it doesn’t exist, create? There should be no error.

Jason

well, if i put validates_uniqueness_of :name, then obviously even if I use find_or_create I cannot create something that is a duplicate and indeed it doesn't get created, the only problem is that I don't get the error on the page though I do get the error in script/console