Module: Toar::Ar::Instance

Defined in:
lib/toar.rb

Instance Method Summary collapse

Instance Method Details

#toar_as_json(name = '') ⇒ Object



82
83
84
85
86
87
88
# File 'lib/toar.rb', line 82

def toar_as_json(name = '')
  inc_opt = self.class.toar_opt(name)[:includes]
  self.class
    .includes(inc_opt)
    .find_by(id: self.id)
    .as_json(Toar.convert_includes_option(inc_opt))
end

#toar_to_json(name = '') ⇒ Object



90
91
92
# File 'lib/toar.rb', line 90

def toar_to_json(name = '')
  toar_as_json(name).to_json
end