@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
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
render :action=>‘createname’

thanx in advance


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


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