I have create new array jobs and j.id is start from 423 and loop creates array index 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
I am working on rails version 3.2.11
Output:
pipe
0: null
1: null
.
.
.
.
423: "jobname"
424: "jobname"
425: "jobname"
426: "jobname"
427: "jobname"
423 "jobname"is weird array it can be['423 jobname', 424 jobname]['423 jobname', '424 jobname']check my updated answer hope it helps