I rub about 1-2 hr before I put them in the smoker. I do 275 until I have a good color. Usually about 2 hr. Wrap until bones start to pull back. The ribs will be pretty tender by then. I stick them back in smoker sauced for about 1/2 hr or so. Sometimes the ribs go straight to a grill from the foil. It depends what kind of flavor profile you want.( A little char on them changes that)
If you heavy rub ribs to early you pull out the moisture. Salt is the enemy.
I have used a very light rub about 8-10 hours before at times. Then shake more rub on before they go on smoker.
I like doing ribs at this 275 temp, seams to produce more moist rib.
This is my way but, not the only way.