Class: Array

Inherits:
Object
  • Object
show all
Defined in:
lib/restfulx/rx_active_support.rb

Instance Method Summary collapse

Instance Method Details

#to_json(options = {}) ⇒ Object

Serialize array as RestfulX friendly JSON (with metadata)



135
136
137
138
# File 'lib/restfulx/rx_active_support.rb', line 135

def to_json(options = {})
  attributes = options.delete(:attributes)
  return (attributes.nil?) ? to_json_original(options) : "[{#{'metadata'.inspect}: #{attributes.to_json}},#{to_json_original(options)[1..-1]}]"
end

#to_json_originalObject



132
# File 'lib/restfulx/rx_active_support.rb', line 132

alias_method :to_json_original, :to_json