Class: Spina::Account

Inherits:
ApplicationRecord show all
Includes:
Partable
Defined in:
app/models/spina/account.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.serialized_attr_accessor(*args) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/models/spina/account.rb', line 23

def self.serialized_attr_accessor(*args)
  args.each do |method_name|
    define_method method_name do
      self.preferences.try(:[], method_name.to_sym)
    end

    define_method "#{method_name}=" do |value|
      self.preferences ||= {}
      self.preferences[method_name.to_sym] = value
    end
  end
end

Instance Method Details

#content(layout_part) ⇒ Object



19
20
21
# File 'app/models/spina/account.rb', line 19

def content(layout_part)
  layout_parts.find_by(name: layout_part).try(:content)
end

#to_sObject



15
16
17
# File 'app/models/spina/account.rb', line 15

def to_s
  name
end