Flowdock
method

set

Importance_1
Ruby on Rails latest stable (v5.2.3) - 0 notes - Class: CurrentAttributes
set(set_attributes) public

Expose one or more attributes within a block. Old values are returned after the block concludes. Example demonstrating the common use of needing to set Current attributes outside the request-cycle:

class Chat::PublicationJob < ApplicationJob
  def perform(attributes, room_number, creator)
    Current.set(person: creator) do
      Chat::Publisher.publish(attributes: attributes, room_number: room_number)
    end
  end
end
Show source
Register or log in to add new notes.