0

I'm new to Ruby on Rails, using Ahoy to track visits and events in my app. I have 2 different devise models, how do I set up Ahoy.user_method to each one?

My devise models are PlayerLog and CoachLog. Should I set this up like this:

Ahoy.user_method = :true_current_player_log
Ahoy.user_method = :true_current_coach_log

Thanks! Regards, Gustavo

Simple Lime
  • 10,790
  • 2
  • 17
  • 32
  • Edit Question: I'm new with RoR and new using Ahoy to track visits and events at my app. Ahoy.user_method is a setting up for Ahoy (not Ahoy_Email). Sorry! – Gustavo Oliveira Mar 04 '18 at 23:10

1 Answers1

0

Without knowing more about your specific use case (such as when a user is a player vs a coach), you can set the user_method to a lambda and handle the logic there:

Ahoy.user_method = -> do |controller|
  if player_user?
    true_current_player_log
  else
    true_current_coach_log
  end
end
rsnorman15
  • 510
  • 3
  • 8