Yeah, but in practice, you'd call @user.save, which internally calls
#valid?, and returns true or false on whether the object was saved or
not. If the object wasn't saved, @user.errors is populated with the
error messages.

-- Eric

On Wed, May 20, 2009 at 4:03 PM, Magnus Holm <[email protected]> wrote:
> I'm a little rusty on AR at the moment, but I think it looks something like
> this:
> In the controller:
> if @user.valid?
>   # everything is fine
> else
>   # ops! @user.errors contains the errors
> end
> //Magnus Holm
>
>
> On Wed, May 20, 2009 at 19:43, David Susco <[email protected]> wrote:
>>
>> Can ActiveRecord::Validations::ClassMethods be used to provide
>> feedback to the user? I noticed the tepee example uses
>> "validates_uniqueness_of ". If the title isn't unique however nothing
>> is written and the user is never notified.
>>
>> Does anyone have an example or two of how I could go about informing
>> the user that the title they entered was not unique and they need to
>> enter another?
>>
>> --
>> Dave
>> _______________________________________________
>> Camping-list mailing list
>> [email protected]
>> http://rubyforge.org/mailman/listinfo/camping-list
>
>
> _______________________________________________
> Camping-list mailing list
> [email protected]
> http://rubyforge.org/mailman/listinfo/camping-list
>
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to