Array and rotate an object along a curve

I'm trying to array an object along a straight curve and I kinda got it to work in a weird way. On the left is what I'm trying to achieve but on the same place as the right. It somehow moved to the left. Also it arrayed like this too, which is not what i wanted.

I just want it to be like this but on the curve i created.

Thanks.