mercredi 23 janvier 2019

How to check value null in ruby on rails 3?

I have create new array jobs and j.id is start from 423 and loop creates array from 0 to total job ids with null value from 0 to 422 id. So my question is how to set condition to check the null value of j.name?

@jobs = []
demo.demojobs.each do | j |
    if j.name != null #condition 
        @jobs[j.id] = j.name
    end
end 

Working with rails version 3.2.11

Aucun commentaire:

Enregistrer un commentaire