class Macros::CurrentUser::Set
Sets the current_user in the context.
Public Class Methods
new(key: :model)
click to toggle source
@return [Macro::CurrentUser::Set] step macro instance
# File lib/macros/current_user/set.rb, line 11 def initialize(key: :model) @key = key end
Public Instance Methods
call(ctx, **)
click to toggle source
Sets the current user in the context @param ctx [Trailblazer::Skill] tbl context hash
# File lib/macros/current_user/set.rb, line 17 def call(ctx, **) return false unless ctx[@key] return false unless VALID_CURRENT_USER_CLASS_NAMES.include? ctx[@key].class.name.demodulize ctx[:current_user] = ctx[@key] end