mardi 13 octobre 2015

Conditional Statements In Ruby on Rails Model File

Is it possible for us to write conditional statements in our Rails model file for example in my case if I want to implement some validations based on if a user is singned_in or not in my Customer.rb file.

if user_signed_in?  // if signed_in is true
     //my validation code here

then some special validations and

else !user_signed_in? // if signed_in is false
     //my validation code here

Aucun commentaire:

Enregistrer un commentaire