Module: YiffSpace::Concerns::CurrentMethods

Extended by:
ActiveSupport::Concern
Defined in:
lib/yiffspace/concerns/current_methods.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#destroy_with_current(*attrs) ⇒ Object



45
46
47
48
49
50
# File 'lib/yiffspace/concerns/current_methods.rb', line 45

def destroy_with_current(*attrs)
  attrs.each do |attr|
    send("#{attr}=", YiffSpace.config.current_class.user)
  end
  destroy
end

#destroy_with_current!(*attrs) ⇒ Object



52
53
54
55
56
57
# File 'lib/yiffspace/concerns/current_methods.rb', line 52

def destroy_with_current!(*attrs)
  attrs.each do |attr|
    send("#{attr}=", YiffSpace.config.current_class.user)
  end
  destroy!
end

#update_with_currentObject



37
38
39
# File 'lib/yiffspace/concerns/current_methods.rb', line 37

def update_with_current(...)
  self.class.with_current(self, :update, ...)
end

#update_with_current!Object



41
42
43
# File 'lib/yiffspace/concerns/current_methods.rb', line 41

def update_with_current!(...)
  self.class.with_current(self, :update!, ...)
end