Class: Spina::Account

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Partable

#part

Class Method Details

.serialized_attr_accessor(*args) ⇒ Object



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

def self.serialized_attr_accessor(*args)
  args.each do |method_name|
    eval "
      def #{method_name}
        self.preferences.try(:[], :#{method_name})
      end

      def #{method_name}=(value)
        self.preferences ||= {}
        self.preferences[:#{method_name}] = value
      end
    "
  end
end

Instance Method Details

#content(layout_part) ⇒ Object



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

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

#to_sObject



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

def to_s
  name
end