Module: MyERP::Model::InstanceMethods

Defined in:
lib/myerp/model.rb

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object



25
26
27
# File 'lib/myerp/model.rb', line 25

def ==(other)
  id == other.id
end

#as_json(args = {}) ⇒ Object



13
14
15
16
17
# File 'lib/myerp/model.rb', line 13

def as_json(args = {})
  inner_json = self.to_hash.stringify_keys
  inner_json.delete("cache_version")
  inner_json
end

#new?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/myerp/model.rb', line 19

def new?
  id.nil?
end

#to_iObject



23
# File 'lib/myerp/model.rb', line 23

def to_i; id; end

#to_json(*args) ⇒ Object



9
10
11
# File 'lib/myerp/model.rb', line 9

def to_json(*args)
  as_json(*args).to_json(*args)
end