In a User model has 4 columns mandatory I have used validate presence true first_name, last_name, username, country.
Now if the user is admin and when I want to update his details I don’t want to check country I want validate presence part from country. In this case how can I do it. I want to update admin who is also user in User model but I want to skip couple of column and need to check rest of the columns to validate presence.
In a User model has 4 columns mandatory I have used validate presence true
first_name, last_name, username, country.
Now if the user is admin and when I want to update his details I don't want
to check country I want validate presence part from country. In this case
how can I do it. I want to update admin who is also user in User model but I
want to skip couple of column and need to check rest of the columns to
validate presence.
when I save things for admin... phone and next_of_name those fields are not
allowing to save. Correct me if is not correct process.
The first line will be executed first, it says validate presence of
everything whether admin or not, so the save fails. That line should
only specify the fields that are always required.
The second line should then say validate the conditional fields, but
they only *not* admin, or unless admin.
By the way, I would prefer it if you could insert your replies into
the previous message rather than top posting. It makes it easier to
follow the thread. Thanks.