Class: Object

Inherits:
BasicObject
Defined in:
lib/active_column/helpers.rb

Instance Method Summary collapse

Instance Method Details

#to_json(*a) ⇒ Object



26
27
28
29
30
31
32
33
34
35
# File 'lib/active_column/helpers.rb', line 26

def to_json(*a)
  result = {
    JSON.create_id => self.class.name
  }
  instance_variables.inject(result) do |r, name|
    r[name[1..-1]] = instance_variable_get name
    r
  end
  result.to_json(*a)
end