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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jochen Kaechelin 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. > > -- > JochenI 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? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Am 05.06.2008 um 22:42 schrieb Shandy Nantz:> > Jochen Kaechelin 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?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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Jun 5, 4:29 pm, Jochen Kaechelin <giss...-mq+tHXhMx+cPyMaTEpOvjQ@public.gmane.org> 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--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---