We consider a holistic approach to find a closed formula for the generalized ray transform of a tensor field. This means that we take refraction, attenuation and time-dependence into account. We model the refraction by an appropriate Riemannian metric which leads to an integration along geodesics. The absorption appears as an attenuation coefficient in an exponential factor. The derived explicit integral formula solves a transport equation whose boundary conditions are given by the measured data. Deriving the weak formulation of the problem, we obtain solutions in Sobolev-Bochner spaces. Whereas it fails to guarantee a unique solution of the implied initial boundary value problem (IBVP), it is possible to prove uniqueness of viscosity solutions by using the Lax-Milgram-theorem. For this, however, certain restrictions on the refractive index and the attenuation coefficient must be assumed. Considering the parameter-to-solution map as the forward operator, the inverse problem can be solved by minimizing a Tikhonov functional. Here the adjoint operator can also be identified as a solution of an IBVP.