How to get current user

Hey,
I am trying to filter favourites for the current user in the rails app.

      attribute :user_favorites do
        favorites.select { |favorites| favorites.user_id == current_user.id }.map { |_f| { name: 'favorites' } }
      end

I am getting errors when reindexing.

NameError (undefined local variable or method current_user’ for #Business:0x000056399578a878)`

Is there any option to get replace the device current_user method

Hi!

Can you give us a little more detail about what you are trying to accomplish? Algolia itself doesn’t have a concept of a user ID. The closest we come is generated userTokens for personalization (Generating userToken | Algolia).

I think this current_user may be coming from your application.