Sha256: 748e13c929aa1dbba515b9069d37e995260bf43bfc47769e40c81b43f36072d8

Contents?: true

Size: 399 Bytes

Versions: 10

Compression:

Stored size: 399 Bytes

Contents

module Tenon
  # Generate a back button that includes the previous query if there was one
  module BackToIndexPathHelper
    def back_to_index_path(obj)
      path = polymorphic_path(obj.class)
      if cookies["last-query-#{path}.json"].present?
        query = JSON.parse(cookies["last-query-#{path}.json"])
        path = polymorphic_path(obj.class, query)
      end
      path
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
tenon-2.1.0 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.8 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.7 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.6 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.5 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.4 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.3 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.2 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.1 app/helpers/tenon/back_to_index_path_helper.rb
tenon-2.0.0 app/helpers/tenon/back_to_index_path_helper.rb