[Q] How to change template file path dinamically?

Hi,

I have a question about template file path.
I want to change template path according to a certain condition.
I tried the following code and it works fine in Rails 2.1.
But I don't know this is good or not.
Is there any good solution? Please give me an advice.

module ActionView #:nodoc:
  class TemplateFinder #:nodoc:
    alias _pick_template_extension_ pick_template_extension #:nodoc:
    def pick_template_extension(template_path) #:nodoc:
      if a_certain_condition()
        new_path = "keitai/#{template_path}"
        template_path.replace(new_path)
      end
      _pick_template_extension_(template_path)
    end
  end
end