Sha256: 22e443c60017db769b4128ba7c60dccad753329e0a54ddf5ccbdc09309a4745c

Contents?: true

Size: 485 Bytes

Versions: 21

Compression:

Stored size: 485 Bytes

Contents

module Workarea
  module Storefront
    module UserActivity
      def user_activity
        return Recommendation::UserActivity.new if current_user_activity_id.blank?

        @user_activity ||= Recommendation::UserActivity.find_or_initialize_by(
          id: current_user_activity_id
        )
      end

      def current_user_activity_id
        current_user.try(:id).presence ||
          session.id.try(:cookie_value).presence ||
          session.id
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
workarea-storefront-3.4.25 app/controllers/workarea/storefront/user_activity.rb