How do I enclose multiple rails database queries into an atomic statement? : I'm manipulating multiple rails database queries which includes two different databases. I want them to enclose such that if one of the queries fails, all others must rollback. In short, I wanna convert them into an atomic statement.

a). LocationRole.create!(
              role: new_params[:role],
              resource_type: 'Hub',
              resource_id: hub_data[:hub_id],
              user_id: new_params[:user_id]
            )
b). LocationRole.create!(
                  role: new_params[:role],
                  resource_type: 'Cluster',
                  resource_id: input[:cluster_id],
                  user_id: new_params[:user_id]
                )
c). User.create(:email=>email,:password=>password,:user_type=>user_type)