Module: Zenbox::UserHelper::ClassMethods

Defined in:
lib/zenbox/user_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



22
23
24
25
26
# File 'lib/zenbox/user_helper.rb', line 22

def self.extended(base)
  base.class_variable_set("@@zenbox_fields", [])

  Zenbox.model = base.to_s
end

Instance Method Details

#zenbox_fields=(*args) ⇒ Object



28
29
30
# File 'lib/zenbox/user_helper.rb', line 28

def zenbox_fields=(*args)
  self.class_variable_set("@@zenbox_fields", args)
end

#zenbox_model(*fields) ⇒ Object



32
33
34
35
36
# File 'lib/zenbox/user_helper.rb', line 32

def zenbox_model(*fields)
  self.send(:zenbox_fields=, *fields)

  after_commit :zenbox_sync!
end