[Rails] Skipping Couple of Validate Presence in model

2015-10-14 Thread honey ruby
Hi everyone, 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

Re: [Rails] Skipping Couple of Validate Presence in model

2015-10-14 Thread Colin Law
On 14 October 2015 at 08:56, honey ruby wrote: > Hi everyone, > > 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

Re: [Rails] Skipping Couple of Validate Presence in model

2015-10-14 Thread honey ruby
am using Rails 3.2.21 I forgot to mention that. Thanks On Wed, Oct 14, 2015 at 1:26 PM, honey ruby wrote: > Hi everyone, > > 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

Re: [Rails] Skipping Couple of Validate Presence in model

2015-10-14 Thread honey ruby
Thanks colin for your reply. I have used this way in my model. validates :first_name, :last_name, :username, :next_of_name, :phone, :email presence: true validates :first_name, :last_name, :username,:password, :password_confirmation, :presence => true, if: :only_for_admin def

Re: [Rails] Skipping Couple of Validate Presence in model

2015-10-14 Thread Colin Law
On 14 October 2015 at 12:41, honey ruby wrote: > Thanks colin for your reply. > > I have used this way in my model. > > validates :first_name, :last_name, :username, :next_of_name, :phone, > :email presence: true > validates :first_name, :last_name,