How to lock texture direction?

I set the std “Oak light” material to some handrails, but when I rotate the handrail the texture remains oriented to world axes. How do I “lock” the texture to follow the object when it’s rotated?

// Rolf

You have to change the texture mapping away from WCS to Mapping Channel, then apply an appropriate texture mapping on the object, I’d do that with a 1x1x1 box mapping, so it is similar to the WCS, except now it’ll “stick” to the object.

Another way I think is to use an OCS frame.