Make an is_admin? method on your user.
def is_admin?
  self.admin # Or how ever you figure out the person is an admin
end

In your validation:

validates_presence_of :email, :if => :is_admin?

That should do it.

On Wed, Jun 24, 2009 at 5:55 AM, Newb Newb <[email protected]
> wrote:

>
> Hi everyone,
>  i have 20 fields in users table.
>  in my admin profile module the admin can modify his infomation.
>  but only 12 fields he can able to modify.
>  for the users email field is not mandatory.but for admin email is a
> mandatory field.
>  how can i use the validates_presence_of method under this requirement.
>  pls help
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
Christopher Warren
[email protected]
612.424.9880

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to