In_place_editor and validations

I have a user model with “validate_uniquness_of :username”.

How to use build-in validations and in_place_editor?

I run Rails 2.1.


Jochen

Jochen K. wrote:

I have a user model with “validate_uniquness_of :username”.

How to use build-in validations and in_place_editor?

I run Rails 2.1.


Jochen

I needed to do the same thing only with phone numbers and email address,
so what I did is used a before_save callback in my model to check on
them to make sure they were formatted properly. I do, however, have the
exact same code that you have - validate_uniquness_of :username. Is this
not working for you or is it throwing some kind of error?

Am 05.06.2008 um 22:42 schrieb Shandy N.:

Jochen

I needed to do the same thing only with phone numbers and email
address,
so what I did is used a before_save callback in my model to check on
them to make sure they were formatted properly. I do, however, have
the
exact same code that you have - validate_uniquness_of :username. Is
this
not working for you or is it throwing some kind of error?

when I work in the console and try to create a user with an already
existing
username the error message is shown. but when I use in_place_editor I
can
change a username to let’s say “jochen” although there’s already such
an entry
in the db.

The problem is how to tell the in place editor that validation
failed. Take a look at
http://www.schumeyer.com/index.php/in-place-editor

I believe this will do what you want.

I have not had time to write much explanation. Feel free to email me
with any questions.