DamnBigMan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-14 20:15 UTC
validates_presence_of?
I have a situation in which I would like it to be possible to create a user. But also allow an administrator to modify certain values associated with that user (username, email, privileges). I have created my own authentication system based on an example I found. My problem is that currently I am validating the presence of all the fields in the table (for new user creation). What would be the best way to have it not worry about some fields (password and confirm for example) when modifying? I don''t want the admin to have access to user passwords. Thanks, Glen --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
DamnBigMan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Mar-14 20:33 UTC
Re: validates_presence_of?
Thanks, actually I saw that in the api but it didn''t click with me. On Mar 14, 2:42 pm, Philip Hallstrom <r...-SUcgGwS4C16SUMMaM/qcSw@public.gmane.org> wrote:> > I have a situation in which I would like it to be possible to create a > > user. But also allow an administrator to modify certain values > > associated with that user (username, email, privileges). I have > > created my own authentication system based on an example I found. > > > My problem is that currently I am validating the presence of all the > > fields in the table (for new user creation). What would be the best > > way to have it not worry about some fields (password and confirm for > > example) when modifying? I don''t want the admin to have access to > > user passwords. > > You can add ":on => :create" where :create can be :update as well.. that > lets you "split" up your validations...--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> I have a situation in which I would like it to be possible to create a > user. But also allow an administrator to modify certain values > associated with that user (username, email, privileges). I have > created my own authentication system based on an example I found. > > My problem is that currently I am validating the presence of all the > fields in the table (for new user creation). What would be the best > way to have it not worry about some fields (password and confirm for > example) when modifying? I don''t want the admin to have access to > user passwords.You can add ":on => :create" where :create can be :update as well.. that lets you "split" up your validations... --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---