Class: Mks::Rent::ApplicationRecord

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/mks/rent/application_record.rb

Direct Known Subclasses

Client, Offer, OfferItem, OfferRequest, RequestItem

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.json(data) ⇒ Object



16
17
18
# File 'app/models/mks/rent/application_record.rb', line 16

def self.json(data)
  ActiveModelSerializers::SerializableResource.new(data).as_json
end

Instance Method Details

#json(data = nil) ⇒ Object



8
9
10
11
12
13
14
# File 'app/models/mks/rent/application_record.rb', line 8

def json(data = nil)
  if data.nil?
    ActiveModelSerializers::SerializableResource.new(self).as_json
  else
    ActiveModelSerializers::SerializableResource.new(data).as_json
  end
end