class ActiveRecord::Base
Public Class Methods
serialize()
click to toggle source
# File lib/json_serializer/rails/active_record_patch.rb, line 7 def self.serialize self.collect{|model| model.send((model.respond_to? :api_attributes) ? :api_attributes : :to_json).merge({:_class_name => self.first.class.name.downcase.pluralize})}.group_by{|d| d[:_class_name] } end
Public Instance Methods
serialize()
click to toggle source
# File lib/json_serializer/rails/active_record_patch.rb, line 3 def serialize {"#{self.class.name.downcase.underscore}" => self.send((self.respond_to? :api_attributes) ? :api_attributes : :to_json)} end