Forum: Rails France find_or_create et @errors

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
997433f165140d58f52b8c0d1d005dc1?d=identicon&s=25 Patrick Aljord (Guest)
on 2007-02-02 19:31
(Received via mailing list)
salut à tous,
jutuilse un validates_uniqueness_of :name.
Dans script/console quand je test find_or_create_by_name('toto') et
que toto existe déjà ca me renvoie bien @errors name has already been
taken. Mais dans mon createname.rhtml ca affiche rien alors que j'ai
bien mis <%= error_messages_for :user %>. Est-ce que vous savez
pourquoi?

dans mon controller jai:
@user = find_or_create_by_name('toto')

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


Merci d'avance

Pat
This topic is locked and can not be replied to.