2

In this reflex I want to set the lastupdateby field to the current_user. I haven't been able to get it to work. Is there something I need to do to get that value in a reflex? Any thoughts on what I am doing wrong? If I hard code the value instead of current_user it works. I must just be referencing it wrong.

def toggle
 todo = Todo.find(element.dataset[:id])
 todo.update(completed_at: (todo.completed_at? ? nil : Time.current), lastUpdatedBy: current_user)
end
spacerobot
  • 265
  • 1
  • 5
  • 23

1 Answers1

3

Ref this,

Add following line in your reflex class.

delegate :current_user, to: :connection
Salil
  • 46,566
  • 21
  • 122
  • 156