You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: template_methods.rb
    path of file: ./repos/resubject/lib/resubject/extensions
    
    the code of the file until where you have to start completion: require 'active_support/time'

module Resubject
  module Extensions
    # All Rails extensions
    module TemplateMethods
      # Generates an attribute using `number_to_currency` helper from rails
      #
      # @example
      #
      #   class ProductPresenter < Resubject::Presenter
      #     currency :price
      #   end
      #
      #   # Will create a `price` at
    
      def time_ago(attribute, include_seconds = false)
        if Gem::Version.new(ActiveSupport::VERSION::STRING) < Gem::Version.new('4')
          define_method attribute do
            return if to_model.send(attribute).nil?
            template.time_ago_in_words to_model.send(attribute), include_seconds
          end
        else
          define_method attribute do
            return if to_model.send(attribute).nil?
            template.time_ago_in_words to_model.send(attribute), include_seconds: include_seconds
          end
        end